New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger complains when optional body parameter is missing from a request #2369

omusil24 opened this Issue Nov 2, 2017 · 0 comments


None yet
2 participants

omusil24 commented Nov 2, 2017

Swagger throws a SCHEMA-VALIDATION-ERROR when not sending body parameter which is defined as optional (required = false) in the Swagger API file.

qrest get http://localhost:8200/api/something -ll
> GET /api/something HTTP/1.1
> hash: (8 members)
  Accept : "text/x-yaml,application/x-yaml,text/xml,application/xml,application/json,application/x-www-form-urlencoded,text/plain"
  User-Agent : "Qore-DataStreamClient/1.1"
  DataStream-Accept : "text/x-yaml"
  DataStream-Accept-Encoding : "gzip,bzip2,deflate"
  Content-Type : "text/x-yaml;charset=utf8"
  Accept-Encoding : "gzip,bzip2,deflate"
  Connection : "Keep-Alive"
  Host : "localhost:8200"
< HTTP/1.1 400 Bad Request
< hash: (8 members)
  http_version : "1.1"
  status_code : 400
  status_message : "Bad Request"
  server : "Qorus-HTTP-Server/"
  x-powered-by : "Qore/"
  content-type : "text/html;charset=utf8"
  connection : "Keep-Alive"
  content-length : "326"
< <html><head><title>400 Bad Request</title></head><body><h1>Bad Request</h1><pre>SCHEMA-VALIDATION-ERROR: Parameter &quot;body&quot; for path &quot;/something&quot; and method &quot;GET&quot; is null, but the expected type is &quot;object&quot;</pre><p><hr><address>Qorus-HTTP-Server/ on xeno</address></body></html>
ERROR: "HTTP/1.1 400 Bad Request" received from "http://localhost:8200/api/something"

@omusil24 omusil24 added this to the milestone Nov 2, 2017

davidnich added a commit that referenced this issue Nov 2, 2017

omusil24 added a commit that referenced this issue Nov 3, 2017

Merge pull request #2372 from qorelanguage/bugfix/2369_Swagger_option…

refs #2369 fixed optional parameter processing in Swagger

@omusil24 omusil24 added the fixed label Nov 3, 2017

@omusil24 omusil24 closed this Nov 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment