Openapi-generator: [python] Paths starting with numerics

Created on 27 Jul 2018  路  4Comments  路  Source: OpenAPITools/openapi-generator

Description

Paths starting with version (not ideal but supported in openapi) generate functions that cannot be called in Python.

openapi-generator version

3.1.1 - Found this issue with all v3 releases

OpenAPI declaration file content or url

For example

servers:
  - url: 'https://penapi.pacnetconnect.com'
paths:
  /1.0.0/account/profile/exchange:
    get:
      summary: Get the current account's Exchange profile
      tags:
        - exchange

creates the following type of call when generated

api_response = api_instance.100_auth_generatetoken_post(grant_type, username, password)
Suggest a fix/enhancement

Digging around the template and i can see that its identifying the numeric because the process creates a file that will start with Model100 .... etc. The function and model however doesnt seem to be doing it this way.

Python Bug

All 4 comments

Update: Did some more digging.

If operation id is missing it will create it using the path but doesnt use the toModelName function to determine if its a name that can be used so it will try to carry the number into the start of the function

@developersteve thanks for reporting the issue. I've filed https://github.com/OpenAPITools/openapi-generator/pull/682 to fix it.

I'll add a test case in another PR to see if other generators (e.g. Java, C#) have similar issues

@developersteve PR merged into master and you can find the change in the v3.2.0 released yesterday.

Awesome thank you

Was this page helpful?
0 / 5 - 0 ratings