Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong status code returned for apis defined as HTTP 201 #203

Closed
jordan-factor opened this issue Dec 11, 2022 · 1 comment
Closed

Wrong status code returned for apis defined as HTTP 201 #203

jordan-factor opened this issue Dec 11, 2022 · 1 comment
Assignees
Labels
added to backlog The issue was added to backlog bug Something isn't working

Comments

@jordan-factor
Copy link

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"}
@ricardozanini ricardozanini added the bug Something isn't working label Dec 12, 2022
@hbelmiro hbelmiro added the added to backlog The issue was added to backlog label Dec 15, 2022
@hbelmiro hbelmiro self-assigned this Mar 14, 2023
@hbelmiro
Copy link
Contributor

@jordan-factor The client (the one this extension generates) is not responsible for defining what status code the server should return.
I'm missing something here or you're misunderstanding this extension. I noticed that in the reproducer you provided, you implemented the interface that this extension generates. That doesn't make sense. A MicroProfile REST Client interface is not supposed to be implemented but only called. It's supposed to be a representation of the endpoint you need to call from your application.

@hbelmiro hbelmiro closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added to backlog The issue was added to backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants