Skip to content
This repository was archived by the owner on Apr 3, 2023. It is now read-only.

Commit 397870a

Browse files
committed
1.2.0
1 parent 46a0707 commit 397870a

File tree

5 files changed

+62
-92
lines changed

5 files changed

+62
-92
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ repos:
7777
hooks:
7878
- id: flake8-markdown
7979
- repo: https://github.com/pycqa/pylint
80-
rev: "v2.14.5"
80+
rev: "v2.15.0"
8181
hooks:
8282
- id: pylint
8383
exclude: "test_*|docs"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
[v1.2.0]
4+
5+
- update to pydantic `v1.1.0`
6+
37
[v1.1.0]
48

59
- removes `v3_0_3`.

poetry.lock

Lines changed: 55 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pydantic-openapi-schema"
3-
version = "1.1.0"
3+
version = "1.2.0"
44
description = "OpenAPI Schema using pydantic. Forked for Starlite-API from 'openapi-schema-pydantic'."
55
authors = ["Na'aman Hirschfeld <nhirschfeld@gmail.com>"]
66
maintainers = ["Na'aman Hirschfeld <nhirschfeld@gmail.com>", "Peter Schutt <peter.github@proton.me>", "Cody Fincher <cody.fincher@gmail.com>"]

tests/v3_1_0/test_pydantic_field.py

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import Union
22

33
from pydantic import BaseModel, Field
4-
from pydantic.schema import schema
54
from typing_extensions import Literal
65

76
from pydantic_openapi_schema.utils.utils import (
@@ -22,51 +21,12 @@
2221
)
2322

2423

25-
def test_pydantic_discriminator_schema_generation() -> None:
26-
"""https://github.com/kuimono/openapi-schema-pydantic/issues/8."""
27-
28-
json_schema = schema([RequestModel])
29-
assert json_schema == {
30-
"definitions": {
31-
"DataAModel": {
32-
"properties": {"kind": {"enum": ["a"], "title": "Kind", "type": "string"}},
33-
"required": ["kind"],
34-
"title": "DataAModel",
35-
"type": "object",
36-
},
37-
"DataBModel": {
38-
"properties": {"kind": {"enum": ["b"], "title": "Kind", "type": "string"}},
39-
"required": ["kind"],
40-
"title": "DataBModel",
41-
"type": "object",
42-
},
43-
"RequestModel": {
44-
"properties": {
45-
"data": {
46-
"anyOf": [{"$ref": "#/definitions/DataAModel"}, {"$ref": "#/definitions/DataBModel"}],
47-
"discriminator": {
48-
"mapping": {"a": "#/definitions/DataAModel", "b": "#/definitions/DataBModel"},
49-
"propertyName": "kind",
50-
},
51-
"title": "Data",
52-
}
53-
},
54-
"required": ["data"],
55-
"title": "RequestModel",
56-
"type": "object",
57-
},
58-
}
59-
}
60-
61-
6224
def test_pydantic_discriminator_openapi_generation() -> None:
63-
"""https://github.com/kuimono/openapi-schema-pydantic/issues/8."""
64-
6525
open_api = construct_open_api_with_schema_class(construct_base_open_api())
6626
json_schema = open_api.components.schemas["RequestModel"] # type: ignore
6727
assert json_schema.properties == {
6828
"data": Schema(
69-
anyOf=[
29+
oneOf=[
7030
Reference(ref="#/components/schemas/DataAModel", summary=None, description=None),
7131
Reference(ref="#/components/schemas/DataBModel", summary=None, description=None),
7232
],

0 commit comments

Comments
 (0)