Replies: 2 comments 9 replies
-
When I copy the https://json-schema.org/learn/miscellaneous-examples.html#arrays-of-things on the playground, I got the expected result : In fact, you made a small mistake when removing Correct schema : {
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"properties": {
"number": {
"type": "number"
},
"street_name": {
"type": "string"
},
"street_type": {
"enum": [
"Street",
"Avenue",
"Boulevard"
]
},
"vegetables": {
"type": "array",
"items": {
"type": "object",
"required": [
"veggieName",
"veggieLike"
],
"properties": {
"veggieName": {
"type": "string",
"description": "The name of the vegetable."
},
"veggieLike": {
"type": "boolean",
"description": "Do I like this vegetable?"
}
}
}
}
},
"additionalProperties": false
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
hey @jy95, are you aware of how does the I'm trying out this {
"$jsonSchema": {
"bsonType": "object",
"required": [ "name", "address" ],
"properties": {
"name": {
"bsonType": "string",
"description": "must be a string and is required"
},
"address": {
"bsonType": "object",
"required": [ "zipcode" ],
"properties": {
"street": { "bsonType": "string" },
"zipcode": { "bsonType": "string" }
}
},
"vegetables": {
"bsonType": "array",
"items": { "$ref": "#/$defs/veggie" }
},
"fruits": {
"bsonType": "array",
"items": {
"bsonType": "string"
}
}
},
"$defs": {
"veggie": {
"bsonType": "object",
"required": [ "veggieName", "veggieLike" ],
"properties": {
"veggieName": {
"bsonType": "string",
"description": "The name of the vegetable."
},
"veggieLike": {
"bsonType": "boolean",
"description": "Do I like this vegetable?"
}
}
}
}
}
} I'm not sure how to parse it, do I replace whatever is in the Thanks |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given an example of the following schema
I took the sample from https://json-schema.org/learn/miscellaneous-examples.html#arrays-of-things but without
$defs
What's currently showing for me is
I don't see such example at https://jy95.github.io/docusaurus-json-schema-plugin/docs/category/-array as well
Wondering if this is the correct display?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions