Skip to content

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

@yissacharcw

Description

@yissacharcw

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"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions