models:
- schema: ${file(models/test.json)}
name: 'Tester'
description: 'Esquema Tester Object'
contentType: 'application/json'
Even though I declared some required fields in the schema, the object is sent when those fields are absent. The request shouldn't be executed successfully under that scenario.
events:
- http:
path: /tester
method: post
integration: lambda
request:
schema:
application/json: ${file(models/test.json)}
template:
application/json: $input.json('$')
documentation: ${file(my-project-api.doc.yml):endpoints.tester}
But that configuration is not desirable since I have to set the request schema in two places, so the risk to break things in big/complex projects are very high.
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Test",
"description": "Tester",
"type": "object",
"required": [ "age", "name" ],
"properties": {
"name": {
"type": "string",
"description": "names"
},
"age" : {
"type": "integer",
"description": "age"
},
"is": {
"type": "boolean",
"description": "type"
}
}
}