Skip to content

Authentication parameter not added to GET endpoints, if no other parameter is available #462

Description

@stenzing

Hi!

I noticed a strange behavior, which I think is a bug in the generation process.

So far when in the response codes the 401 was present, then a @NotNull Authentication authentication parameter was generated into the API server side stubs, which was working for most of the endpoint correctly, where there was any parameter beside it, like a path parameter, or a body, or anything. I noticed today, that in the specific case (which is for ex a top level listing endpoint) when no other parameter exists, then this authentication parameter is also omitted, despite the fact, that in the responses status codes the 401 is present.

So the following works as expected:

  /memorial:
    get:
      operationId: "getMyStuff"
      description: "List stuff"
      tags:
        - my_controller
      parameters:
        - in: query
          name: order_by
          required: false
          schema:
            type: string
      responses:
        401:
          description: "Unauthorized"
        200:
          description: "List of stuff"

while the following is not:

  /memorial:
    get:
      operationId: "getMyStuff"
      description: "List stuff"
      tags:
        - my_controller
      responses:
        401:
          description: "Unauthorized"
        200:
          description: "List of stuff"

I would assume it is a bug, but had no time to dissect the generation code to find the cause yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions