Skip to content

Order of operations for transform and custom keywords #390

@carlo-quinonez

Description

@carlo-quinonez

I understand that standard keywords, such as format will be run before any custom keywords, such as transform. So if we want to transform a string BEFORE validating its format, we have to use $allOf to force the order.

In my case, we're considering using transform to turn a proprietary version number format into something close to a semver, then using the semver keyword from the ajv-semver to validate and clean up the coercion.

What would determine the order?

  • The order the keywords are added to ajv
  • The order the keywords appear in the JSONSchema

Can we count on the order?

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