Skip to content

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

@myronmarston

Description

@myronmarston

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions