Skip to content

Mapping between properties #6

@m-mohr

Description

@m-mohr

We often see two fields that depend on each other, i.e. the value of one field depends on the other.

For example:

  • crop_id
  • crop_name

Can we validate that? For example through a map? Does it make things to complicated?

How would that work in JSON Schema? A discussion in their Slack lead to the conclusion that the only reasonable way is anyOf:

anyOf: [
  {properties: {name: {const: 1}, id: {const: "apple"}}},
  {properties: {name: {const: 2}, id: {const: "peach"}}},
  ...
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions