swagger-api / swagger-api/swagger-codegen

[Java-PlayFramework] response with status 201

Open
#7,583 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

When the response status is 201 (created), the autogenerated controller is giving a 200 (ok).

Swagger-codegen version

2.3.0-SNAPSHOT

Swagger declaration file content or url
"/phone_numbers/{phone_number}/foo": {
      "post": {
        "tags": [
          "foo"
        ],
        "operationId": "createFoo",
        "description": "Create foo for a phone number",
        "responses": {
          "201": {
            "description": "Created"
            }
Steps to reproduce

Just check this line. We are not considering the response that the swagger could give.

Any idea @JFCote ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiController.mustache, specifically the referenced line 224. Compare the generated controller behavior with the declared 201 response in the Swagger definition. Done means the autogenerated response preserves the declared 201 status instead of returning 200.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.