Contributions
Re: Required parameters from multiple schemas
Thanks a lot! I have it mostly working, and have a much better understanding of how to overlay schemas. That said, is there any way to get the response to include what required property is in violation when an incorrect JSON payload is sent? In my old spec, the 'single' schema would return what property/element was in violation. What I have now just returns ... ' is not valid under any of the given schemas'. The client receives this: {<JSON request body> is not valid under any of the given schemas", "status": 400, "title": "Bad Request", "type": "about:blank" }2.4KViews0likes1CommentRequired parameters from multiple schemas
Hello, I'm trying to enforce required parameters in both the 'check_single' and 'check_set' below. The required parameters work when passing when they match the 'check_single', but I haven't been successful in the require being enforced in the 'check_set'. The only difference between to the 2 is that 'check_set' allows consumers to send a list. This is being used in conjunction with Flask/Connexion in Python 3.6. I've been through all the applicable examples and docs I can find, but I'm still stuck. openapi: 3.0.0 info: version: 1.0.0 title: check create paths: /monitor/v1/submit: post: summary: "submit checks" operationId: "create_v1.publish_body_v1" requestBody: content: application/json: schema: $ref: '#/components/schemas/check' responses: '201': description: OK components: schemas: check: title: check request single anyOf: - $ref: '#/components/schemas/check_single' - $ref: '#/components/schemas/check_set' required: ["hostname", "team_name"] properties: hostname: type: string team_name: type: string check_definition: type: object required: ["command", "subscriptions", "interval", "publish", "handlers", "metadata"] properties: command: type: string subscriptions: type: array items: type: string interval: type: integer publish: type: boolean handlers: type: array items: type: string metadata: type: object required: ["name", "namespace", "labels"] properties: name: type: string namespace: type: string labels: type: object required: ["type", "environment", "application"] properties: type: type: string example: "Either dynamic or static" enum: - dynamic - static environment: type: string description: "Environment lab for IEM. This is the environment as know by IEM" application: type: string description: "Application name as IEM knows it" service_key: type: string description: "PD service key for incident handling" notification_channel: type: string description: "incident generation tool" remediation_action: type: string description: "remediation action" notifcation_enable: type: boolean description: "incident/notification generation enabled" check_single: title: check request single type: object check_set: title: set of checks type: array description: "check set" items: type: objectSolved2.4KViews0likes3Comments