json-schema-validator icon indicating copy to clipboard operation
json-schema-validator copied to clipboard

Macro support

Open SridharSubramaniam opened this issue 6 years ago • 3 comments

Hi,

Is there a way to do something equivalent to macro in ajv? Ability to provide a dynamic schema on a keyword.

https://ajv.js.org/custom.html

SridharSubramaniam avatar Feb 24 '20 16:02 SridharSubramaniam

The library is based on Java which is a static compiled language. Unlike Javascript that you can dynamically add new functions or new validators, we can only add this first and make the function or validator available during the runtime.

stevehu avatar Feb 24 '20 17:02 stevehu

Hmm. The schema is known upfront. It's more preprocessing that makes it available - isn't it?

Ability to return altered schema pre-validation? No?

SridharSubramaniam avatar Feb 24 '20 17:02 SridharSubramaniam

I don't think it is pre-processing. All the extension must be compiled and made available to invoke like all validators.

stevehu avatar Feb 24 '20 18:02 stevehu