From cce055d2ca7d3030e5a712f3e6e7e41b04c4f97a Mon Sep 17 00:00:00 2001 From: artsmolin Date: Mon, 2 Oct 2023 20:44:28 +0300 Subject: [PATCH] Update docs --- README.md | 8 ++++---- docs/README.md | 9 ++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9efdf49..bfc8c59 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -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 \ diff --git a/docs/README.md b/docs/README.md index 8f60fb8..25113c5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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 \ @@ -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)