swagger-api / swagger-api/swagger-codegen
jaxrs-jersey generated server stub fails for responses of media type=text/plain
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
If I generate a jaxrs-jersey server stub from the yaml below, run it and access http://localhost:8080/test/ping it fails with MessageBodyWriter not found for media type=text/plain, type=class io.swagger.api.ApiResponseMessage, genericType=class io.swagger.api.ApiResponseMessage.
Swagger-codegen version
3.0.16
Swagger declaration file content or url
openapi: 3.0.0
info:
version: '0.0.1'
title: ''
description: ''
servers:
- description: localhost
url: http://localhost:8080/test
paths:
/ping:
get:
responses:
'200':
description: OK
content:
text/plain:
schema:
type: string
example: pong
Command line used for generation
Steps to reproduce
- open the attached yaml in https://editor.swagger.io/ and generate jaxrs-jersey server
- extract and run with
mvn clean package jetty:run - run the GET /ping from the https://editor.swagger.io/
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied OpenAPI YAML and reproduce the failure by generating the jaxrs-jersey server stub, then running mvn clean package jetty:run and requesting /ping. Inspect the generated server stub's handling of the text/plain response; done means the request completes without a MessageBodyWriter error and returns the declared response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100