Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
artsmolin committed Oct 2, 2023
1 parent 4a147e3 commit cce055d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Check documentation to see more details about the features. All documentation is
- [Sync](/examples/petstore/client_sync.py) and [async](/examples/petstore/client_async.py) clients for [Petstore OpenAPI](/examples/petstore/openapi.yaml)

## Installation
Pip
You can install the library
```shell
pip install pythogen
```
Docker
or use Docker
```shell
docker pull artsmolin/pythogen
```
Expand All @@ -34,12 +34,12 @@ docker pull artsmolin/pythogen
- `path/to/input` — path to the directory with openapi.yaml;
- `path/to/output` — the path to the directory where the generated client will be saved;

Pip
Generate a client using the installed library
```shell
pythogen path/to/input/openapi.yaml path/to/output/client.py
```

Docker
or via Docker
```shell
docker run \
-v ./path/to/input:/opt/path/to/input \
Expand Down
9 changes: 2 additions & 7 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Generate a client using the installed library
```shell
pythogen path/to/input/openapi.yaml path/to/output/client.py
```
or via docker Docker
or via Docker
```shell
docker run \
-v ./path/to/input:/opt/path/to/input \
Expand Down Expand Up @@ -175,12 +175,7 @@ client = Client(
```

### Discriminator
Pythogen is able to generate a base class in which the logic of the discriminator is implemented by the value of the specified field. To do this, the desired field in the "description" parameter must contain a text
```
__discriminator__(BaseClassName.field)
```
- `BaseClassName` — desired name of the base class
- `field` — discriminator field
Generate [pydantic classes with discriminators](https://docs.pydantic.dev/latest/api/standard_library_types/#discriminated-unions-aka-tagged-unions) based on [OpenAPI discriminators](https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/). The original OpenAPI specification must have the propertyName and mapping fields.

## Examples
- [Sync](/examples/petstore/client_sync.py) and [async](/examples/petstore/client_async.py) clients for [Petstore OpenAPI](/examples/petstore/openapi.yaml)

0 comments on commit cce055d

Please sign in to comment.