openapi3 icon indicating copy to clipboard operation
openapi3 copied to clipboard

$ref in path

Open ElliottBregni opened this issue 6 years ago • 5 comments

I see this is a TODO. Any progress or updates you could share with me?

ElliottBregni avatar Jul 17 '19 18:07 ElliottBregni

i'm not sure if there is active development on this library... @ElliottBregni have u found alternatives?

zeph avatar May 11 '20 12:05 zeph

is this what u meant @ElliottBregni ?

cause it is exactly giving me trouble in parsing the public Atlassian's swagger href

openapi3.errors.SpecError: Expected components.schemas.avatarUrls to be one of [['Schema', 'Reference']], but found {'description': 'The avatars of the user.', '$ref': '#/components/schemas/AvatarUrlsBean'}

zeph avatar May 11 '20 15:05 zeph

I have a similar Issue.

while parsing this spec file, I received this error:

SpecError: Could not parse paths./nf-instances.get.parameters.6, expected to be one of [['Parameter', 'Reference']]

This is how the causing section looks like:

{
    "name": "target-plmn-list",
    "in": "query",
    "description": "Id of the PLMN of the target NF",
    "content": {
        "application/json": {
            "schema": {
                "type": "array",
                "items": {
                    "$ref": "TS29571_CommonData.yaml#/components/schemas/PlmnId"
                },
                "minItems": 1
            }
        }
    }
}

It should be valid OAS3, right?

c7h avatar Nov 26 '21 17:11 c7h

@c7h - One issue i see with your spec is the use of reference items in another file. From what i can tell, openapi3 (this library) doesn't follow file $refs and can only handle everything in the same file (there don't appear to be any additional calls to yaml.load_safe other than in __main__.py

chriswhite199 avatar Jan 21 '22 05:01 chriswhite199

@c7h the above is true - at present this library does not load additional files when following $refs.

Additionally, the Parameter object has no content; it should instead have a schema that describes the parameter:

{
    "name": "target-plmn-list",
    "in": "query",
    "description": "Id of the PLMN of the target NF",
    "schema": {
        "type": "array",
        "items": {
            "$ref": "TS29571_CommonData.yaml#/components/schemas/PlmnId"
        },
        "minItems": 1
    }
}

Making this change results in the following (expected) error:

ReferenceResolutionError: Invalid reference path TS29571_CommonData.yaml#/components/schemas/PlmnId

Dorthu avatar Jan 26 '22 13:01 Dorthu