sagold / json-schema-library

Customizable and hackable json-validator and json-schema utilities for traversal, data generation and validation
MIT License
164 stars 19 forks source link

Remove additional properties #53

Open dodas opened 5 months ago

dodas commented 5 months ago

Is there a way to remove additional properties from objects, similar to ajv's removeAdditional?

sagold commented 4 months ago

Hi Jozef,

there is an option to remove invalid data in getTemplate https://github.com/sagold/json-schema-library/blob/main/lib/getTemplate.ts#L19. So you can pass in your current data run getTemplate with it, resulting in data that conforms to the json-schema. Would this help your case?

Cheers, Sascha