Skip to content

[BUG][Python] Unable to use args as schema property because it collides with another method input #13954

@MustansirS

Description

@MustansirS

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When generating a Python client from specs where a API request body has a field named args defined, the generated model file corresponding to the Request Body object contains the following error: Duplicate parameter "args"

openapi-generator version

6.2.1

OpenAPI declaration file content or url

pythonbug.yaml

openapi: 3.0.2
info:
  title: Bug API
  version: '0.0'
  contact:
    name: Curvegrid
  description: Python Client Bug API.
servers:
  - url: 'http://{hostname}'
    variables:
      hostname:
        default: localhost:8080
        description: Bug Test Server.
tags:
  - name: test
paths:
  /foo:
    post:
      operationId: foo
      summary: FooBaz
      description: FooBar.
      tags:
        - test
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Request'
      responses:
        '200':
          description: OK
components:
  schemas:
    Request:
      title: Request
      type: object
      description: A test request body.
      properties:
        args:
          type: string
      required:
        - args
Generation Details
Steps to reproduce

openapi-generator-cli generate -g python -i pythonbug.yaml -o python_client

Related issues/PRs
Suggest a fix

Add args to reserved words

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions