Skip to content

Conversation

@eak24
Copy link
Contributor

@eak24 eak24 commented Dec 29, 2019

Fix NPE in PythonExperimentalCodegen and put openapi_types into a method so that circular dependencies don't break at module load time.

#4885

PR checklist

  • [ x] Read the contribution guidelines.
  • [ x] If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • [x ] Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • [ x] File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • [ x] Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10) @Jyhess (2019/01) @slash-arun (2019/11) @spacether (2019/11)

@spacether
Copy link
Contributor

@ethan92429 I am working on fixing this too in a separate branch

When you make a PR you can test it locally by following the below steps:

  1. produce the new sample client:
    bin/python-experimental-petstore.sh

  2. Run the petstore server:
    docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore

  3. run the tests
    cd samples/client/petstore/python-experimental
    make test

That will show the python test errors without having to run them on the CI servers

@eak24
Copy link
Contributor Author

eak24 commented Dec 29, 2019

@spacether thanks for the tip! I think I'll wait for your branch, then - can I follow your progress somewhere?

@spacether
Copy link
Contributor

@spacether thanks for the tip! I think I'll wait for your branch, then - can I follow your progress somewhere?

Okay, sounds good. Yup, the branch that I am working on is at:
https://github.com/spacether/openapi-generator/tree/issue_4885_allow_self_properties

Your update is going in the right direction. It was throwing errors because we can't use @staticmethod and @Property together because @Property only refers to instance variables, not class variables
per https://stackoverflow.com/questions/1697501/staticmethod-with-property#7864317

The remaining work that I have to do is omitting the module name from the class property only if the property is in self model.

@jimschubert
Copy link
Member

Sounds like this has been fixed? Can this PR be closed?

@spacether
Copy link
Contributor

Thank you for raising this issue @ethan92429
We are closing this PR because this merged pr resolved the same issue #4888

@spacether spacether closed this Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants