Skip to content

Generator confused by duplicated path parameter #1574

Closed

Description

@evankanderson

This may be a bit weird, but I found it in the wild in https://www.keycloak.org/docs-api/24.0.1/rest-api/openapi.yaml

I get the following error with a very simple config:

package: client
output: client.gen.go
generate:
  models: true
  client: true

I get the following error:

error generating code: error creating operation definitions: path '/admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites/clients/{client-uuid}' has 4 positional parameters, but spec has 3 declared

Here's the relevant excerpt of the keycloak YAML (note that {client-uuid} is repeated in the URL):

openapi: 3.0.3
paths:
  /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites/clients/{client-uuid}:
    get:
      tags:
      - Roles
      summary: Get client-level roles for the client that are in the role's composite
      parameters:
      - name: client-uuid
        in: path
        required: true
        schema:
          type: string
      - name: role-name
        in: path
        description: role's name (not id!)
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string

Activity

  1. jamietanna commented on Apr 24, 2024

    @jamietanna
    Member
  2. added
    bug
    on Apr 24, 2024
  3. added this to the v2.2.0 milestone on Apr 24, 2024
  4. jamietanna commented on May 3, 2024

    @jamietanna
    Member

    Hey, just closing the loop on this one - as mentioned in pb33f/libopenapi#278 this is actually an issue with the spec and it's recommended you either work with the upstream to modify the spec to correct it, or fix it locally prior to generation. Appreciate you raising it, that was a TIL for me too!

  5. evankanderson commented on May 4, 2024

    @evankanderson
    Author

    FWIW, it sounds like vacuum, as a linter, is flagging this as against best practices, but the construction is actually allowed by the spec.

    Would you be open to a PR to enable generation in this case, even though vacuum complains with a (silenceable) warning?

  6. added 2 commits that reference this issue on Feb 14, 2026
    a85766d
    1650807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugspec-issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions