datacontract-cli
datacontract-cli copied to clipboard
JSON Schema Import: references and allof/oneof/anyof
Thanks for this PR! Looks fine, but let's exclude the definitions here for now as this needs discussion.
- The reference mechanism of JSON schema differs from Data Contract Specification.
- The Data Contract Specification currently does not support the allOf/oneOf/anyOf logic of JSON schema.
Let's discuss each of those separately.
Regarding 1: Without the allOf/oneOf/anyOf logic, we could implement an import that makes use of the definitions in DCS. We could use the $ref mechanism to link to the referenced definition. No problem here. The difference, however, is that one can override the fields (in JSON schema, you cannot). But this should not be an issue here, but more an issue when you'd do an export to JSON schema when using $ref.
Regarding 2: We could support this with config options, e.g., like this:
models:
my-model:
config:
jsonSchemaAllOf:
- ref1
- ref2
Originally posted by @simonharrer in https://github.com/datacontract/datacontract-cli/issues/201#issuecomment-2112492939