Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

[BUG][python] Common parameter for a path not working #237

@nponsard

Description

@nponsard
Description

When a Common path parameter is present in a specification, the generator doesn't generate any way to input this parameter in the function (no path_parameters.py created in the paths/users_user_id/get folder).

Adding the path parameter manually in the method (in the get: of the yaml file) the correct files and function get created.

openapi-json-schema-generator version

Latest docker image (digest 09665ca30ce8)

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: NetHSM
  version: v1
 servers:
  - url: https://{host}/api/{version}
    variables:
      host:
        default: localhost:8443
      version:
        default: v1
paths:
  /users/{UserID}:
    parameters:
      - name: UserID
        in: path
        required: true
        schema:
          type: string
    get:
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: string
        "401":
          description: Authentication required but none provided.
        "403":
          description: Access denied.
        "404":
          description: User for UserID not found.
        "406":
          description: Content type in Accept header not supported.
        "412":
          description: Precondition failed (NetHSM was not *Operational*).
      description: "Get user info: name and role."
      security:
        - basic: []
      x-annotation-role:
        - Administrator
        - Operator
      x-annotation-state:
        - Operational
      x-test-value-UserID: operator
    put:
      responses:
        "201":
          description: Successful creation of user.
        "400":
          description: Bad request (specified properties are invalid, e.g. weak passphrase).
        "401":
          description: Authentication required but none provided.
        "403":
          description: Access denied.
        "406":
          description: Content type in Accept header not supported.
        "409":
          description: Conflict - user already exists for this user-ID.
        "412":
          description: Precondition failed (NetHSM was not *Operational*).
      description: Create a user on keyfender.
      requestBody:
        content:
          application/json:
            schema:
              type: string
        required: true
      security:
        - basic: []
      x-annotation-role:
        - Administrator
      x-annotation-state:
        - Operational
      x-test-value-UserID: newOperator
    delete:
      responses:
        "204":
          description: Successful deletion of user.
        "401":
          description: Authentication required but none provided.
        "403":
          description: Access denied.
        "404":
          description: User not found for this user-ID.
        "406":
          description: Content type in Accept header not supported.
        "412":
          description: Precondition failed (NetHSM was not *Operational*).
      description: Delete a user from keyfender.
      security:
        - basic: []
      x-annotation-role:
        - Administrator
      x-annotation-state:
        - Operational
      x-test-value-UserID: operator
components:
  securitySchemes:
    basic:
      description: |
        NetHSM supports Basic Authentication.
      type: http
      scheme: basic
Generation Details

executed

docker run --rm -ti -v "${OPENAPI_OUTPUT_DIR}:/out" \
openapijsonschematools/openapi-json-schema-generator-cli:latest generate \
-i=/out/nethsm-api.yaml \
-g=python -o=/out/python --package-name=pynitrokey.nethsm.client
Steps to reproduce

Run the generator, check the files, no path parameter input in the functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions