Skip to content

How would I reuse definitions from objects? #301

Closed Answered by CarstenWickner
digital-h asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @digital-h,

Fortunately, I already answered a very similar question here: #246 (comment)
That includes a complete code example.


More generically speaking: What you ask for requires some custom configuration, as per this FAQ entry:
https://victools.github.io/jsonschema-generator/#how-to-reference-a-separate-schema-file

How to reference a separate schema/file?

By using withCustomDefinitionProvider() – one of the advanced configurations – you can fully control the contents of a type's sub-schema. Simply create a node that only contains your custom/external reference instead of the actual schema. It is recommended to mark the custom definition as "to be inlined", in order to avoid an ext…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CarstenWickner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants