Closed
Description
Thanks for a great library! :-)
Describe the bug
I wish to send an object as a JSON string in a query parameter to a GET-request.
I would expect the OpenAPI Description for the query parameter to be defined using the content attribute as described on https://swagger.io/docs/specification/describing-parameters/ under the heading "schema vs content", but instead it uses the schema attribute. It seems a specified media type is ignored for query parameters.
To Reproduce
Using Spring Boot version 2.3.1.RELEASE and springdoc-openapi-ui version 1.4.3
Sample RestController code:
package com.example.springboottest;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class HelloController {
@GetMapping("/some-method")
public SomeResponse someMethod(@Parameter(content = @Content(mediaType = "application/json", schema = @Schema(implementation = SomeRequest.class))) @RequestParam String request) {
return new SomeResponse();
}
public static class SomeRequest {
public String requestString;
}
public static class SomeResponse {
public String responseString;
}
}
Expected behavior
Expected OpenAPI Description:
"parameters": [
{
"name": "request",
"in": "query",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SomeRequest"
}
}
}
}
],
Actual OpenAPI Description:
"parameters": [
{
"name": "request",
"in": "query",
"required": true,
"schema": {
"$ref": "#/components/schemas/SomeRequest"
}
}
],