Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Is "type" a required keyword? If not, how should validation be handled when a type is not specified? #172

Closed
@jessepinho

Description

@jessepinho

According to json-schema.org:

When the primitive type of the instance cannot be validated by a given keyword, validation for this keyword and instance SHOULD succeed.

However, it is unclear whether the "primitive type" refers to the instance itself, or to the schema's type keyword. If the latter, how should an instance be validated if the schema is missing a type keyword for the instance? For example, if an instance is validated against a schema containing simply { required: ["a", "b"] }, should it be inferred that the schema describes an object, and thus validation should fail if the instance is, say, an integer? If so, what about if the schema also has non-object keywords, like minimum?

IMHO, a schema missing a type keyword should be considered invalid, as that makes validation of an instance impossible. And as a result, any instance validated against it should succeed.

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