Skip to content

MergeAdditionalProperties and JSON Schema spec #19

Description

@Allam76

According to here: "Schema inheritance", the following is true:

JSON Schema doesn't use an object oriented paradigm, so concepts like inheritance don't translate well. JSON Schema is a collection of constraints. It's subtractive rather than additive like most people are used to. This means that given an empty schema, the set of valid JSON documents is the set of all JSON documents. As you add keywords, you are subtracting from the set of valid JSON documents. Once something is removed from the set, it can't be added back in.

This means that for instance enums: from a subschema, instead as beeing merged with the enums of the base schema, they should restrict the base schema. This is obviously not what lodash merge does and if desired, requires some additional logic.

If people already use mergeAdditionalProperties, maybe another option could be used?
Also beware, combining two schema is apparently against the philosophy of JSON schema.

I'll take a look and come back.
#17
#18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions