valentinpalkovic/prisma-json-schema-generator

Union types with `anyOf` instead of array

Closed this issue · 3 comments

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.

@JulianCataldo Interested in opening a PR? :)

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

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