Metadata-Version: 2.1
Name: swagger-codegen
Version: 0.1.16
Summary: Generate API clients by parsing Swagger definitions
Home-page: https://github.com/asyncee/swagger_codegen
License: MIT
Keywords: swagger-codegen,openapi,swagger,pydantic
Author: asyncee
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Provides-Extra: all
Provides-Extra: async
Provides-Extra: black
Provides-Extra: sync
Requires-Dist: aiohttp; extra == "async" or extra == "all"
Requires-Dist: black; extra == "black" or extra == "all"
Requires-Dist: click (>=7.1.1,<8.0.0)
Requires-Dist: inflection (>=0.4.0,<0.5.0)
Requires-Dist: jinja2 (>=2.11.1,<3.0.0)
Requires-Dist: multidict (>=4.7.5,<5.0.0)
Requires-Dist: pydantic (>=1.4,<2.0)
Requires-Dist: requests; extra == "sync" or extra == "all"
Requires-Dist: rich (>=0.8.11,<0.9.0)
Requires-Dist: schemathesis (==1.1.0)
Requires-Dist: toml (>=0.10.0,<0.11.0)
Requires-Dist: typer (>=0.1.1,<0.2.0)
Project-URL: Documentation, https://github.com/asyncee/swagger_codegen
Project-URL: Repository, https://github.com/asyncee/swagger_codegen
Description-Content-Type: text/markdown

## Swagger codegen for Python

### Installation

```bash
pip install swagger-codegen
```

### Usage example

```
# Generate Petstore Api client using 'petstore' package name.
swagger_codegen generate http://petstore.swagger.io:8080/api/v3/openapi.json petstore

python

Python 3.8.1 (default, Jan 23 2020, 13:58:52) 
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> from petstore import new_client, Configuration
>>> from swagger_codegen.api.adapter.requests import RequestsAdapter
>>> from petstore.apis.user.createUser import User
>>> client = new_client(RequestsAdapter(), Configuration(host="http://petstore.swagger.io:8080"))
>>> print(client.user.createUser(User(id=1, username="Swagger-Codegen")))
id=1 username='Swagger-Codegen' firstName=None lastName=None email=None password=None phone=None userStatus=0
```

You can see [example source code](https://github.com/asyncee/swagger_codegen/tree/master/example)
for [PetStore](http://petstore.swagger.io:8080/) Api in example directory of a project.

You can test example client with following command:

```bash
# Run from project directory.
python -m example.petstore_example 
```

### Code generators (also known as renderers)

There are two code generator strategies in project:

1. Render client as usual python package via `PackageRenderer`
2. Render client as installable python package via `InstallablePackageRenderer`

You can choose what renderer to use by specifying `renderer` key in `.swagger-codegen.toml`
file. Please see `.swagger-codegen.toml.example` for allowed values.

### Known issues

- Content of generated files differs run-to-run because each time functions or data
data transfer objects ordered differently. Functionally clients stay the same, but
each time the code is generated there are large diff generated by git.

### Work in progress

Though library gives nice results for generated API, it is still in development.
Some tests are missing. API is a subject to change until stable release.

Anyway backward compatibility will be kept as most as possible.

The code is not optimized yet and mostly dirty because the project was born
as a holiday prototype.

Also `example` directory may be out of sync with actual generated code.

### Contributors

- livestalker
- coderfromhere

