class-validator-jsonschema icon indicating copy to clipboard operation
class-validator-jsonschema copied to clipboard

classValidatorToJsonSchema - Get JSON Schema for a specific class

Open jan-demsar opened this issue 4 years ago • 0 comments

Hello.

First of all, thank you for amazing package! It is very useful, but in my case I needed ability to extract JSON Schema for a specific class (with duplicate names).

The problem with validationMetadatasToSchemas is that it merges schemas with the same names.

So if I have 1 User class with name property and another with firstName, JSON Schema will include both (obviously I could use unique names, but for current project I cannot avoid duplicates).

As a workaround I created a separate function which solves the issue for me and might be useful for someone else as well.

jan-demsar avatar Nov 02 '20 16:11 jan-demsar