Skip to content

Invalid PythonIdentifier used #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mtovts opened this issue Aug 16, 2021 · 1 comment · Fixed by #477
Closed

Invalid PythonIdentifier used #475

mtovts opened this issue Aug 16, 2021 · 1 comment · Fixed by #477
Labels
🐞bug Something isn't working

Comments

@mtovts
Copy link
Contributor

mtovts commented Aug 16, 2021

Describe the bug
Generator produces black error and invalid model.

To Reproduce
Steps to reproduce the behavior:

  1. Generate lib from example OpenAPI
  2. See error traceback
  File "/Users/Matvey/Documents/GitHub/openapi-python-client/openapi_python_client/__init__.py", line 113, in build
    self._reformat()
  File "/Users/Matvey/Documents/GitHub/openapi-python-client/openapi_python_client/__init__.py", line 146, in _reformat
    subprocess.run(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'black .' returned non-zero exit status 123.
  1. See generated model. It uses import statement.
    @classmethod
    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
        d = src_dict.copy()
        import =
        import cls

        import.additional_properties = d
        return import

Expected behavior
The identifier import_ should be used.

OpenAPI Spec File

openapi: 3.0.3
info:
  title: 'Example'
  version: 0.1.0
servers:
  - url: 'http://example.com'
paths:
  '/foo':
    delete:
      responses:
        '200':
          description: OK
components:
  schemas:
    import:
      type: object
      properties: { }

Desktop (please complete the following information):

  • OS: [e.g. macOS 10.15.1] macOS 11.4
  • Python Version: [e.g. 3.8.0] Python 3.9.5
  • openapi-python-client version [e.g. 0.1.0] 0.10.2

Additional context
It worked correctly on 0.10.1. And in my branch fix / overriding-parameters works well too.

@mtovts mtovts added the 🐞bug Something isn't working label Aug 16, 2021
@dbanty
Copy link
Collaborator

dbanty commented Aug 16, 2021

Whoops, clearly the tests around that feature aren't good enough. Thanks for testing and reporting so quickly!

dbanty added a commit that referenced this issue Aug 16, 2021

Unverified

This user has not yet uploaded their public signing key.
…476]. Thanks @mtovts!
dbanty added a commit that referenced this issue Aug 16, 2021

Unverified

This user has not yet uploaded their public signing key.
…476]. Thanks @mtovts!
dbanty added a commit that referenced this issue Aug 16, 2021

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
…476]. Thanks @mtovts!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞bug Something isn't working
Projects
None yet
2 participants