Settings

Theme

Show HN: Auto-Generate Python REST API Clients Using OpenAPI Generator

5 points by wing328hk 3 years ago · 2 comments · 1 min read


Hi all,

We've refactored the Python client generator in OpenAPI Generator(http://github.com/openapitools/openapi-generator). To give it a try, please follow 3 simple steps below:

1. Download the Java JAR: https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/6.3.0-SNAPSHOT/openapi-generator-cli-6.3.0-20221217.085631-50.jar

2. Rename the JAR as "openapi-generator-cli.jar"

3. Execute the following command to run the generator for the PetStore API: https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml

Mac/Linux:

$ java -jar openapi-generator-cli.jar generate -g python-nextgen -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /var/tmp/python-nextgen/

Windows:

$ java -jar openapi-generator-cli.jar generate -g python-nextgen -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o C:\tmp\python-nextgen

(If JVM is not installed in your machine, please use openapi-genreator-cli docker image instead: https://hub.docker.com/r/openapitools/openapi-generator-cli)

If you've any feedback or question, please reply to https://github.com/OpenAPITools/openapi-generator/pull/14157 to let me know.

samarthr1 3 years ago

So what has changed between the versions?

  • wing328hkOP 3 years ago

    The new Python client should be easier to use and more pythonic.

    Please give it a try to see if you like it.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection