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

Add Null Keyword #601

Merged
merged 7 commits into from
Mar 12, 2020
Merged

Add Null Keyword #601

merged 7 commits into from
Mar 12, 2020

Conversation

WoH
Copy link
Collaborator

@WoH WoH commented Mar 3, 2020

Goals

  1. Support TypeScript's null keyword
  2. Represent null as a "nullable" enum with type [null]
  3. Distinguish between nullable (null) and required/optional (undefined)
  4. Support Swagger whenever possible*

* OpenAPI can use anyOf, to combine schemas. In case of Swagger, we need to check if we are combining a non-$ref type with null. In this case we can set x-nullable: true. Otherwise, we need to bail out since {$ref: '', ['x-nullable']: true} does not work/will be ignored (sibling values along $ref are ignored).

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you written unit tests?
  • Have you written unit tests that cover the negative cases (i.e.: if bad data is submitted, does the library respond properly)?
  • This PR is associated with an existing issue?

Closing issues

Closes #557, #479, #497 (presumably), #257 (presumably), #510

If this is a new feature submission:

  • Has the issue had a maintainer respond to the issue and clarify that the feature is something that aligns with the goals and philosophy of the project?

Potential Problems With The Approach

Breaks compat

@WoH WoH added this to the 3.0 milestone Mar 3, 2020
@WoH WoH changed the title 3.x Nullable Add Null Keyword Mar 3, 2020
@dgreene1
Copy link
Collaborator

dgreene1 commented Mar 3, 2020

Looks good to me! Great work! :)

@WoH
Copy link
Collaborator Author

WoH commented Mar 3, 2020

I'll try to add more tests around validation and integration, but I wanted to make sure we are all on board with the approach.

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