swaggest / rest

Web services with OpenAPI and JSON Schema done quick in Go
https://pkg.go.dev/github.com/swaggest/rest
MIT License
335 stars 17 forks source link

Response content type values in openapi.json do not match actual response content type values #122

Closed pboguslawski closed 1 year ago

pboguslawski commented 1 year ago

Describe the bug

Response content type in openapi.json is application\json regardless of DefaultSuccessResponseContentType and DefaultErrorResponseContentType introduced in https://github.com/swaggest/rest/pull/116.

To Reproduce

In any API project with success and error reponses set

    response.DefaultSuccessResponseContentType = "application/dummy+json"
    response.DefaultErrorResponseContentType = "application/problem+json"

and see application\json as 200 and error response content type in generated openapi.json.

Expected behavior

In openapi.json 200 response should have content type set with DefaultSuccessResponseContentType and error responses should have content type set with DefaultErrorResponseContentType.

Additional context

Actual 200 and error API response content types are equal to DefaultSuccessResponseContentType and DefaultErrorResponseContentType accordingly so it's fine.

Issue is only about response content types in openapi.json.