1
- # openapi-schema- pydantic
1
+ # openapi-pydantic
2
2
3
- [ ![ PyPI] ( https://img.shields.io/pypi/v/openapi-schema- pydantic )] ( https://pypi.org/project/openapi-schema-pydantic/ )
4
- [ ![ PyPI - License] ( https://img.shields.io/pypi/l/openapi-schema- pydantic )] ( https://github.com/kuimono /openapi-schema- pydantic/blob/master /LICENSE )
3
+ [ ![ PyPI] ( https://img.shields.io/pypi/v/openapi-pydantic )] ( https://pypi.org/project/openapi-schema-pydantic/ )
4
+ [ ![ PyPI - License] ( https://img.shields.io/pypi/l/openapi-pydantic )] ( https://github.com/mike-oakley /openapi-pydantic/blob/main /LICENSE )
5
5
6
- OpenAPI (v3) specification schema as [ Pydantic] ( https://github.com/samuelcolvin/pydantic ) classes .
6
+ OpenAPI schema implemented in [ Pydantic] ( https://github.com/samuelcolvin/pydantic ) .
7
7
8
8
The naming of the classes follows the schema in
9
9
[ OpenAPI specification] ( https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#schema ) .
10
10
11
11
## Installation
12
12
13
- ` pip install openapi-schema- pydantic `
13
+ ` pip install openapi-pydantic `
14
14
15
15
## Try me
16
16
17
17
``` python
18
- from openapi_schema_pydantic import OpenAPI, Info, PathItem, Operation, Response
18
+ from openapi_pydantic import OpenAPI, Info, PathItem, Operation, Response
19
19
20
20
# Construct OpenAPI by pydantic objects
21
21
open_api = OpenAPI(
@@ -74,7 +74,7 @@ Pydantic is a great tool, allow you to use object / dict / mixed data for for in
74
74
The following examples give the same OpenAPI result as above:
75
75
76
76
``` python
77
- from openapi_schema_pydantic import OpenAPI, PathItem, Response
77
+ from openapi_pydantic import OpenAPI, PathItem, Response
78
78
79
79
# Construct OpenAPI from dict
80
80
open_api = OpenAPI.parse_obj({
@@ -112,8 +112,8 @@ The approach to deal with this:
112
112
``` python
113
113
from pydantic import BaseModel, Field
114
114
115
- from openapi_schema_pydantic import OpenAPI
116
- from openapi_schema_pydantic .util import PydanticSchema, construct_open_api_with_schema_class
115
+ from openapi_pydantic import OpenAPI
116
+ from openapi_pydantic .util import PydanticSchema, construct_open_api_with_schema_class
117
117
118
118
def construct_base_open_api () -> OpenAPI:
119
119
return OpenAPI.parse_obj({
@@ -264,8 +264,8 @@ More info about field alias:
264
264
265
265
| OpenAPI version | Field alias info |
266
266
| --------------- | ---------------- |
267
- | 3.1.0 | [ here] ( https://github.com/kuimono /openapi-schema- pydantic/blob/master/openapi_schema_pydantic /v3/v3_1_0/README.md#alias ) |
268
- | 3.0.3 | [ here] ( https://github.com/kuimono /openapi-schema- pydantic/blob/master/openapi_schema_pydantic /v3/v3_0_3/README.md#alias ) |
267
+ | 3.1.0 | [ here] ( https://github.com/mike-oakley /openapi-pydantic/blob/main/openapi_pydantic /v3/v3_1_0/README.md#alias ) |
268
+ | 3.0.3 | [ here] ( https://github.com/mike-oakley /openapi-pydantic/blob/main/openapi_pydantic /v3/v3_0_3/README.md#alias ) |
269
269
270
270
### Non-pydantic schema types
271
271
@@ -274,19 +274,19 @@ Please refer to the following for more info:
274
274
275
275
| OpenAPI version | Non-pydantic schema type info |
276
276
| --------------- | ----------------------------- |
277
- | 3.1.0 | [ here] ( https://github.com/kuimono /openapi-schema- pydantic/blob/master/openapi_schema_pydantic /v3/v3_1_0/README.md#non-pydantic-schema-types ) |
278
- | 3.0.3 | [ here] ( https://github.com/kuimono /openapi-schema- pydantic/blob/master/openapi_schema_pydantic /v3/v3_0_3/README.md#non-pydantic-schema-types ) |
277
+ | 3.1.0 | [ here] ( https://github.com/mike-oakley /openapi-pydantic/blob/main/openapi_pydantic /v3/v3_1_0/README.md#non-pydantic-schema-types ) |
278
+ | 3.0.3 | [ here] ( https://github.com/mike-oakley /openapi-pydantic/blob/main/openapi_pydantic /v3/v3_0_3/README.md#non-pydantic-schema-types ) |
279
279
280
280
### Use OpenAPI 3.0.3 instead of 3.1.0
281
281
282
282
Some UI renderings (e.g. Swagger) still do not support OpenAPI 3.1.0.
283
283
It is allowed to use the old 3.0.3 version by importing from different paths:
284
284
285
285
``` python
286
- from openapi_schema_pydantic .v3.v3_0_3 import OpenAPI, ...
287
- from openapi_schema_pydantic .v3.v3_0_3.util import PydanticSchema, construct_open_api_with_schema_class
286
+ from openapi_pydantic .v3.v3_0_3 import OpenAPI, ...
287
+ from openapi_pydantic .v3.v3_0_3.util import PydanticSchema, construct_open_api_with_schema_class
288
288
```
289
289
290
290
## License
291
291
292
- [ MIT License] ( https://github.com/kuimono /openapi-schema- pydantic/blob/master /LICENSE )
292
+ [ MIT License] ( https://github.com/mike-oakley /openapi-pydantic/blob/main /LICENSE )
0 commit comments