YousefED / typescript-json-schema

Generate json-schema from your Typescript sources
BSD 3-Clause "New" or "Revised" License
3.17k stars 323 forks source link

Question: Possibility to add root property which states that the file is generated? #471

Open boesing opened 2 years ago

boesing commented 2 years ago

Hey there,

I've recently found this package and so far it works very nice. One thing I would really love would be something to be added to the generated schema which makes it clear that it is actually generated.

I was thinking about a few possibilities tho:

Generated information

{
     "$generated": "This file was generated via typescript-json-schema and therefore should not be manually changed"
}

Referencing the typescript file which was used to determine the schema

{
     "$source": "src/module/Foo.ts"
}

The $source could be added to all definitions (in case they have a dedicated file and are not part of Foo.ts for example). 🤷🏼‍♂️


WDYT? Would love to get some feedback here. Maybe thats already possible and I just did not dig deep enough in this component.