Skip to content

List of objects with required values #191

Answered by karenetheridge
Siecje asked this question in Q&A
Discussion options

You must be logged in to vote
"type": "array",
"items": { // this schema applies to all items
  "type": "object",
  "required": [ "address", "first_name", "last_name" ],
  "properties": {
    "address": { "type": "string", ... },
    .. all your other property definitions here...
  },
  "oneOf": [
    { "required": [ "phone_ number" ] },
    { "required": [ "cell_ number" ] }
  ]
}

See https://json-schema.org/understanding-json-schema/reference/combining.html and https://json-schema.org/understanding-json-schema/reference/array.html

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Siecje
Comment options

@Siecje
Comment options

@karenetheridge
Comment options

Answer selected by handrews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants