Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nullable references #184

Closed
wants to merge 1 commit into from

Conversation

provokateurin
Copy link

No description provided.

@kynx
Copy link

kynx commented Apr 24, 2023

Are you sure the spec allows this? My understanding of the Reference Object is that it doesn't:

This object cannot be extended with additional properties and any properties added SHALL be ignored.

FWIW, I seem to recall an ugly hack to work around this restriction. Something like:

NullableThingy:
    nullable: true
    oneOf:
        - $ref: "#/components/schemas/Thingy"

@provokateurin
Copy link
Author

Note that this restriction on additional properties is a difference between Reference Objects and Schema Objects that contain a $ref keyword.

I see, so my problem actually seems to be that something gets interpreted as a Reference object instead of as a Schema object (since that allows nullable together with $ref).

@provokateurin
Copy link
Author

Ok this is a specific bug in my application. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants