Error on validation: events.0.k must be one of the following

I am trying to validate below object but it gives error on validation -

{
  "_id": "<objectId>",
  "title": "<string>",
  "artist": "<string>",
  "location": "<string>",
  "on_display": "<bool>",
  "in_house": "<bool>",
  "events": [
     {"k": "date_acquisition", "v":"<date>"}, 
     { "k": "moma", "v": "<date>"},
     { "k": "louvres", "v": "<date>"}
  ]
}

Errors :-
events.0.k: events.0.k must be one of the following:
events.1.k: events.1.k must be one of the following:
events.2.k: events.2.k must be one of the following:

I am not sure for this error, can someone please help me with this error

Read Formatting code and log snippets in posts and re-publish you schema. As it is right know we are missing every thing in between < and >.

image

Attached the image of the code I am trying to validate.

1 Like

If you look at all the schema examples, you will surely notice that they do not have field values (like date_acquisition, moma, louvres) but field types (like <date>, <bool>, <string>).

Since the error is about the events.n.k fields, I would try to use a field type rather than a field value.

2 Likes