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

Union types with anyOf instead of array #874

Closed
JulianCataldo opened this issue Jan 6, 2023 · 3 comments · Fixed by #1318
Closed

Union types with anyOf instead of array #874

JulianCataldo opened this issue Jan 6, 2023 · 3 comments · Fixed by #1318
Labels
enhancement New feature or request

Comments

@JulianCataldo
Copy link

Hello :)

It seems like

"type": ["string", "null"]

would be better off with:

{
  "anyOf": [
    {
      "type": "string"
    },
    {
      "type": "null"
    },
  ]
}

As AJV docs specifies: https://ajv.js.org/strict-mode.html#strict-types

Stemming from this issue:
seriousme/fastify-openapi-glue#445 (comment)

Any specific reason for this format (I never encountered it before TBH)?

Thanks for your work.

@valentinpalkovic valentinpalkovic added the enhancement New feature or request label Jan 20, 2023
@valentinpalkovic
Copy link
Owner

@JulianCataldo Interested in opening a PR? :)

@JulianCataldo
Copy link
Author

When I'll go back to the project using it, I'll try to hack the generator internals a bit, to see.

@alexandrtovmach
Copy link
Contributor

@valentinpalkovic please take a look on PR. Added this feature

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

Successfully merging a pull request may close this issue.

3 participants