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

Nullable enum #1021

Closed
wants to merge 5 commits into from
Closed

Conversation

mattpolzin
Copy link
Contributor

What issue does this pull request resolve?
#993

What changes did you make?
I moved the check for whether the nullable option is true AND the nullable property is true into a definition and then used that definition in the existing validation step that adds null to the array of types allowed as well as in the enum keyword step to add null to any enumerated list of values that might be present on a nullable property.

Is there anything that requires more attention while reviewing?
I'm very unfamiliar with doT so please let me know if I've created any code that does not meet standards or bets practices.

@epoberezkin
Copy link
Member

Thanks for the PR.

I am afraid it cannot be addressed in such a narrow way. See OAI/OpenAPI-Specification#1900 (comment)

Firstly, OpenAPI needs to clarify whether interpretation 1 or 2 in that comment is correct - it would require a major version change. Today's OpenAPI docs are closer to interpretation 2, in which case this PR is simply wrong. 2 is also consistent with the proposal in OAI/OpenAPI-Specification#1389

If OpenAPI decides that interpretation 1 is correct and updates the spec, then ALL schema keywords should be skipped not just "enum". Among standard keywords only "const" and "enum" are affected, but there may be other custom keywords and they should also be skipped.

Either way, before any change is made here, OpenPAI position should be clarified and reflected in the docs.

@mattpolzin
Copy link
Contributor Author

Indeed. I agree with your decision after reading that whole comment thread. I think it’s unfortunate that something can be “nullable” and disallow actually having a null value by omitting it from the enum, but that’s an OpenAPI topic.

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

Successfully merging this pull request may close these issues.

None yet

2 participants