Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change json schema customizations to use a custom validator rather than walking the whole schema #22

Open
myronmarston opened this issue Apr 29, 2013 · 0 comments

Comments

@myronmarston
Copy link
Contributor

Interpol differs from json schema in a couple ways:

  • additionalProperties: false is the default in interpol; in json-schema it defaults to true
  • required: true is the default in interpol (overridable with optional: true); in json-schema required defaults to false
  • If the scalars_nullable_by_default option is true, then scalars will get a schema type like [ integer, null ] rather than just integer.

The way we currently accomplish this is to walk the schema of each endpoint and mutate it, adding the necessary properties to get the behavior we want.

However, this approach can be quite slow: in our app we have over 130 endpoint definitions, and it takes about 2 seconds to load all of them, largely because interpol is walking the schema definitions in each. This makes some of our tests quite slow :(. If, instead, we used a custom validator it wouldn't need to walk the schema up front and could be much faster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant