Skip to content
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

[BUG] Query param content type does not pass validation #6059

Open
4 of 6 tasks
yissacharcw opened this issue Apr 26, 2020 · 0 comments
Open
4 of 6 tasks

[BUG] Query param content type does not pass validation #6059

yissacharcw opened this issue Apr 26, 2020 · 0 comments

Comments

@yissacharcw
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

According to https://swagger.io/docs/specification/describing-parameters/#schema-vs-content we can use content along with a nested schema to specify that query params are encoded as JSON objects. OpenAPIGenerator does not seem to respect this and gives the following error:

Execution failed for task ':openApiGenerate'.
> There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
   | Error count: 1, Warning count: 0
  Errors: 
  	-attribute paths.'/foobar'(get).[jsonFilter].content is unexpected
openapi-generator version

4.3.0 Gradle plugin

OpenAPI declaration file content or url
{"swagger":"3.0.1", "info": {"title": "Content test"}, "host":"localhost","basePath":"/","tags":[{"name":"FooAPI"}],"paths":{"/foobar":{"get":{"tags":["FooAPI"],"operationId":"getFoobar","produces":["application/json"],"parameters":[{"name": "jsonFilter", "in": "query", "type": "object", "content":  {"application/json": {"schema":  {"type": "object", "properties": {"wheeee": "string"}}}}}],"responses":{"200":{"description":"Ok","schema":{"type":"string"}},"400":{"description":"Bad Request","schema":{"type":"string"}}}}}}}
Command line used for generation
openApiGenerate {
    generatorName = "java"
    library = "okhttp-gson"
    inputSpec = "myswagger.yaml"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant