quarkus-openapi-generator icon indicating copy to clipboard operation
quarkus-openapi-generator copied to clipboard

Wrong status code returned for apis defined as HTTP 201

Open jordan-factor opened this issue 2 years ago • 0 comments

If I define an api as returning 201 the successful response actually returns 200

Example here: https://github.com/factor-hardware/bug-report-quarkiverse-quarkus-openapi-generator-201-returns-as-200

openapi: 3.0.3
info:
  title: "bug report"
  version: "1.0.0"
  description: "bug report 201 not returned for apis marked 201"
servers:
  - url: https://localhost
components:
  schemas:
    Thing:
      type: object
      properties:
        name: { type: string }

paths:
  /v1/Things:
    post:
      tags:
        - things
      operationId: thingsCreate
      responses:
        "201":
          description: Created
          content:
            "application/json":
              schema:
                $ref: "#/components/schemas/Thing"
curl -X POST -v 'http://localhost:8080/v1/Things'
*   Trying ::1:8080...
* Connected to localhost (::1) port 8080 (#0)
> POST /v1/Things HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.77.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-length: 35
< Content-Type: application/json;charset=UTF-8
< 
* Connection #0 to host localhost left intact
{"name":"i should return http 201"}

jordan-factor avatar Dec 11 '22 17:12 jordan-factor