Skip to content

/v3/api-docs json endpoint returns json api specs encoded in one string #900

Closed
@ewirch

Description

@ewirch

Version 1.4.8. Default configuration. Running:

curl http://localhost:8080/v3/api-docs

Returns:

"{\"openapi\":\"3.0.1\",\"info\":{\"title\":\"OpenAPI definition\",\"vers...

I replaced the remainder of the response by "...", because it is already clear, that this is not the spec in json, but: spec in json encoded in a json string. Response should be:

{"openapi":"3.0.1","info":{"title":"OpenAPI definition","vers...

The problem is the content type definition and the String return type:

	@GetMapping(value = API_DOCS_URL, produces = MediaType.APPLICATION_JSON_VALUE)
	public String openapiJson(HttpServletRequest request, @Value(API_DOCS_URL) String apiDocsUrl)
			throws JsonProcessingException {

If Spring "knows" how to convert to Json, it will convert the returned string value to a Json string (the observed result).

A plain text content type might help, or returning the actual object when Spring knows how to convert to Json.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions