Closed gordonjb closed 7 months ago
Actual behavior (the bug) You can't add examples to responses where the endpoint just returns a String, e.g.:
@OpenApi( summary = "xxxxxx", description = "xxxxxx", operationId = "xxxxxx", path = "/xxxxxx/:id", methods = HttpMethod.PUT, pathParams = {@OpenApiParam(name = "id", type = String.class, description = "xxxxxx")}, requestBody = @OpenApiRequestBody(content = {@OpenApiContent(from = DTOClass.class)}), responses = { @OpenApiResponse(status = "200", content = {@OpenApiContent(from = String.class)}, description = "A string is returned describing changes."), @OpenApiResponse(status = "400", content = {@OpenApiContent(from = String.class)}, description = "Returned if JSON was malformed") } ) @OpenApiExample(objects = { @OpenApiExampleProperty(value="example 1"), @OpenApiExampleProperty(value="example 2"), @OpenApiExampleProperty(value="example 3"), @OpenApiExampleProperty(value="example 4") }) private void xxxxxx(Context context) { ... }
similarly,
@OpenApiExample("example 1") private void xxxxxx(Context context) { ... }
also doesn't work. The "Example Value" section in swagger UI just shows string
string
Expected behavior Examples can be displayed in the "Example Value" section
To Reproduce Example config given above
Additional context dzikoysk — Today at 17:13 Yeah, I think we miss that particular field - it should be on OpenApiContent to reflect Media Type Object: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-12
Actual behavior (the bug) You can't add examples to responses where the endpoint just returns a String, e.g.:
similarly,
also doesn't work. The "Example Value" section in swagger UI just shows
string
Expected behavior Examples can be displayed in the "Example Value" section
To Reproduce Example config given above
Additional context dzikoysk — Today at 17:13 Yeah, I think we miss that particular field - it should be on OpenApiContent to reflect Media Type Object: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-12