Closed evilsneer closed 2 years ago
Hi!
I use swagger as below, and schema, which martian generates contains keys of data dict as required, but it is not. So queries "fails" on client side.
Swagger-ui handles this case (no red stars above fields in model view).
{ "swagger": "2.0", "x-id": [ "mango.routes.services/api" ], "info": { "title": "my-api", "description": "https://cljdoc.org/d/metosin/reitit" }, "paths": { "/api/datasets/phones": { "post": { "responses": { "default": { "description": "" } }, "produces": [ "application/json", "application/transit+msgpack", "application/transit+json", "application/edn" ], "consumes": [ "application/json", "application/transit+msgpack", "application/transit+json", "application/edn" ], "parameters": [ { "in": "body", "name": "body", "description": "", "required": true, "schema": { "type": "object", "properties": { "phone": { "type": "object", "properties": { "operation": { "title": "Operation", "description": "operations on field", "enum": [ "=", "contains", "startswith", "like" ], "default": "=", "type": "string" }, "value": { "type": "string", "x-nullable": true } }, "required": [ "operation", "value" ] }, "gender": { "type": "object", "properties": { "operation": { "title": "Operation", "description": "operations on field", "enum": [ "=", "startswith", "like", "contains" ], "default": "=", "type": "string" }, "value": { "type": "string", "x-nullable": true } }, "required": [ "operation", "value" ] }, "age": { "type": "object", "properties": { "operation": { "title": "Operation", "description": "operations on field", "enum": [ "=", "contains", "startswith", "like" ], "default": "=", "type": "string" }, "value": { "type": "string", "x-nullable": true } }, "required": [ "operation", "value" ] } }, "required": [] <<--- empty ! } } ], "summary": "select from table `phones`", "operationId": "phones" } } } }
Hi,
Thanks for reporting. So the top level keys should be optional, but martian thinks they are required?
Cheers
Yes, that's right!
This is available now in 0.1.21-SNAPSHOT
0.1.21-SNAPSHOT
Hi!
I use swagger as below, and schema, which martian generates contains keys of data dict as required, but it is not. So queries "fails" on client side.
Swagger-ui handles this case (no red stars above fields in model view).