You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Great library! Is it possible to get a flattened JSON schema that has all of the $ref's replaced with their actual value? I'm writing a code generator based on my JSON schemas and I'm a heavy (ab)user of $ref. Right now I'm using this lib and doing this myself using the refs and refVal values of the compiled schema, but thought I'd post here in case there's a better approach.
Thanks,
Brett.
The text was updated successfully, but these errors were encountered:
Creating dereferenced schemas for recursive schemas is simply not possible (short of creating objects with circular references), and recursive schemas are a very common use case.
A better approach for code generation (and actually any schema-based processing) is to use custom keywords and your own context object that will be passed to them (see passContext option) and can accumulate the results of processing or anything else.
In this case you won't have to worry about traversing the schema and interpreting keywords items, properties etc. You will only have to implement your custom processing in custom keywords and Ajv will iterate the schema for you. I used this approach in jsonscript-js.
Hi! Great library! Is it possible to get a flattened JSON schema that has all of the $ref's replaced with their actual value? I'm writing a code generator based on my JSON schemas and I'm a heavy (ab)user of $ref. Right now I'm using this lib and doing this myself using the
refs
andrefVal
values of the compiled schema, but thought I'd post here in case there's a better approach.Thanks,
Brett.
The text was updated successfully, but these errors were encountered: