Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Conversation

kylef
Copy link
Member

@kylef kylef commented Apr 24, 2019

Fixes #217

More context can be found in the large comment I added inside the function that is altered below.

@kylef kylef added the openapi2 label Apr 24, 2019
@kylef kylef requested a review from pksunkara April 24, 2019 16:09
//
// The below code attemps to dereference an example, but if we can't we
// will just return the example (possibly a "reference object") to be
// the example value.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to point out, the information in this comment is not new. I think it is worth clarifying what the function does and why. In the past there are also cases where invalid reference would be treated as example value, this PR just adds one additional case.

@kylef kylef force-pushed the kylef/schema-example-invalid branch from 07416df to e253fba Compare April 24, 2019 16:11
version: 1.0.0
paths: {}
definitions:
Test:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 'Schema Object' declares an array type which has an sample value of an array. The array's first value is an object which has a key $ref and the value #/info, it is not a reference as per the spec and we are not treating it as one since it doesn't reference any valid component in the document.

@kylef kylef force-pushed the kylef/schema-example-invalid branch from 3f82d7b to 09bfa6d Compare April 26, 2019 12:18
@pksunkara pksunkara merged commit 95df0a9 into master Apr 29, 2019
@kylef kylef deleted the kylef/schema-example-invalid branch April 29, 2019 14:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Swagger: unhandled throw from function lookupReference
2 participants