Closed rgregg closed 10 years ago
You can find more details at http://support.apiary.io/knowledgebase/articles/147279-json-schema-validation. Example:
# Note [/notes/{id}]
## Retrieve one Note [GET]
+ Request
... (Schema can be used here too to validate sent data, if any. E.g. when POSTing JSON encoded form-data)
+ Response (application/json)
+ Body
{ "id": 2, "title": "Pick-up posters from post-office" }
+ Schema
{
"type": "object",
"required": false,
"properties": {
"title": {
"type": ["string", "null"],
"required": false
},
"id": {
"type": "number",
"required": true
}
}
}
@rgregg Hope the question has been answered – If still uncertain, please ask at Stack Overflow http://stackoverflow.com/questions/tagged/apiblueprint using the apiblueprint
tag. We will take care of any questions there. Thanks.
@zdne wouldn't it be better to update the documentation rather than point people to stackoverflow?
@gondo you are indeed correct! @kylef is working on a new set of tutorials that will definitely cover this. Thanks for pointing this one out.
@zdne cool.
in the meantime, this might help someone, or someone might help me :) http://stackoverflow.com/questions/28221984/how-to-create-nested-schema
Thanks for sharing! :+1:
Are there more details about what content goes in the Schema section in a Payload? The documentation just says "Specifies a validation schema for the HTTP message-body" but doesn't provide any examples.