Skip to content

Merging examples #22

@ottomata

Description

@ottomata

Hiya, I'm not sure if this should be in json-schema-merge-allof or just left up to me to write a custom resolver.

When merging JSONSchemas, I think we can assume that any examples of each of the to-be-merged schemas should also be merged. Since JSONSchema examples is an array, we need to merge each corresponding examples array element in each of the to-be-merged schemas. When encountering arrays, the default behavior seems to be to concatenate them, but examples should have each element merged.

I wrote a custom resolver for examples here: https://github.com/wikimedia/jsonschema-tools/pull/14/files
but I could alternatively submit a PR to make this the default behavior for examples if that would make sense to you.

Feel free to decline this issue if you'd rather not change the behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions