Open NitayRabi opened 3 years ago
This is done on purpose - the fragment can be used by other schemas that are not removed... What's the use case that requires to remove the fragment?
Ended up here trying to figure out why removeSchema, followed by addSchema wasn't working for me. My schema object has a different "id" than the "key" I use for it. This code allows me to replace the schema:
this.ajv.removeSchema(this.ajv.getSchema(schemaName)?.schema);
this.ajv.removeSchema(schemaName);
Originally, when I just did removeSchema(schemaName)
, the schema was still stored under ajv.refs
What version of Ajv are you using? Does the issue happen if you use the latest version? 6.12.4
Ajv options object
Your code
**Why does this happen ? In some cases a fragments object is populated - https://github.com/ajv-validator/ajv/blob/master/lib/ajv.js#L218
This object is not cleared when calling
removeSchema
(unlike_refs
&_schemas
) https://github.com/ajv-validator/ajv/blob/master/lib/ajv.js#L262What results did you expect?
Are you going to resolve the issue?