Skip to content

Commit

Permalink
1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher committed Aug 4, 2022
1 parent c6977ce commit 1b34eaa
Show file tree
Hide file tree
Showing 22 changed files with 114 additions and 76 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ repos:
exclude: "^(?!starlite/)"
additional_dependencies:
[
openapi_schema_pydantic,
pydantic_openapi_schema,
orjson,
pydantic,
pydantic_factories,
Expand All @@ -97,7 +97,7 @@ repos:
args: ["--unsafe-load-any-extension=y"]
additional_dependencies:
[
openapi_schema_pydantic,
pydantic_openapi_schema,
orjson,
pydantic,
pydantic_factories,
Expand All @@ -115,7 +115,7 @@ repos:
orjson,
types-PyYAML,
types-requests,
openapi_schema_pydantic,
pydantic_openapi_schema,
pydantic,
pydantic_factories,
starlette,
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,9 @@
[1.7.3]

- Fix to routes being allowed under static paths and improvements to path resolution @Dr-Emann

[1.8.0]

- Breaking: Replace [openapi-pydantic-schema](https://github.com/kuimono/openapi-schema-pydantic)
with [pydantic-openapi-schema](https://github.com/starlite-api/pydantic-openapi-schema).
- [Stoplights Elements](https://stoplight.io/open-source/elements) OpenAPI support @aedify-swi
4 changes: 2 additions & 2 deletions docs/usage/3-parameters/0-path-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ If you want to add validation or enhance the OpenAPI documentation generated for
so using the [Parameter function](./3-the-parameter-function.md):

```python
from openapi_schema_pydantic.v3.v3_1_0.example import Example
from openapi_schema_pydantic.v3.v3_1_0.external_documentation import (
from pydantic_openapi_schema.v3_1_0.example import Example
from pydantic_openapi_schema.v3_1_0.external_documentation import (
ExternalDocumentation,
)
from starlite import get, Parameter
Expand Down
75 changes: 56 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "starlite"
version = "1.7.3"
version = "1.8.0"
description = "Light-weight and flexible ASGI API Framework"
authors = ["Na'aman Hirschfeld <[email protected]>"]
maintainers = ["Na'aman Hirschfeld <[email protected]>", "Peter Schutt <[email protected]>", "Cody Fincher <[email protected]>"]
Expand Down Expand Up @@ -33,7 +33,6 @@ packages = [

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
openapi-schema-pydantic = "*"
orjson = "*"
pydantic = "*"
pydantic-factories = "*"
Expand All @@ -43,6 +42,7 @@ starlette = "*"
typing-extensions = "*"
requests = { version = "*", optional = true }
brotli = { version = "*", optional = true }
pydantic-openapi-schema = "*"

[tool.poetry.dev-dependencies]
hypothesis = "*"
Expand Down
2 changes: 1 addition & 1 deletion starlite/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
from starlite.utils.templates import create_template_engine

if TYPE_CHECKING:
from openapi_schema_pydantic.v3.v3_1_0.open_api import OpenAPI
from pydantic.typing import AnyCallable
from pydantic_openapi_schema.v3_1_0.open_api import OpenAPI
from starlette.types import ASGIApp, Receive, Scope, Send

from starlite.handlers.base import BaseRouteHandler
Expand Down
27 changes: 12 additions & 15 deletions starlite/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,21 @@
Tuple,
Type,
Union,
cast,
)
from urllib.parse import urlencode

from openapi_schema_pydantic.util import construct_open_api_with_schema_class
from openapi_schema_pydantic.v3.v3_1_0.contact import Contact
from openapi_schema_pydantic.v3.v3_1_0.external_documentation import (
ExternalDocumentation,
)
from openapi_schema_pydantic.v3.v3_1_0.info import Info
from openapi_schema_pydantic.v3.v3_1_0.license import License
from openapi_schema_pydantic.v3.v3_1_0.open_api import OpenAPI
from openapi_schema_pydantic.v3.v3_1_0.path_item import PathItem
from openapi_schema_pydantic.v3.v3_1_0.reference import Reference
from openapi_schema_pydantic.v3.v3_1_0.security_requirement import SecurityRequirement
from openapi_schema_pydantic.v3.v3_1_0.server import Server
from openapi_schema_pydantic.v3.v3_1_0.tag import Tag
from pydantic import AnyUrl, BaseModel, DirectoryPath, constr, validator
from pydantic_openapi_schema.utils import construct_open_api_with_schema_class
from pydantic_openapi_schema.v3_1_0.contact import Contact
from pydantic_openapi_schema.v3_1_0.external_documentation import ExternalDocumentation
from pydantic_openapi_schema.v3_1_0.info import Info
from pydantic_openapi_schema.v3_1_0.license import License
from pydantic_openapi_schema.v3_1_0.open_api import OpenAPI
from pydantic_openapi_schema.v3_1_0.path_item import PathItem
from pydantic_openapi_schema.v3_1_0.reference import Reference
from pydantic_openapi_schema.v3_1_0.security_requirement import SecurityRequirement
from pydantic_openapi_schema.v3_1_0.server import Server
from pydantic_openapi_schema.v3_1_0.tag import Tag

from starlite.cache import CacheBackendProtocol, SimpleCacheBackend
from starlite.openapi.controller import OpenAPIController
Expand Down Expand Up @@ -207,7 +204,7 @@ def create_openapi_schema_model(self, app: "Starlite") -> OpenAPI:
plugins=app.plugins,
use_handler_docstrings=self.use_handler_docstrings,
)
return cast("OpenAPI", construct_open_api_with_schema_class(schema))
return construct_open_api_with_schema_class(schema)


class StaticFilesConfig(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion starlite/openapi/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from typing import Any, Dict, Pattern, Type, Union
from uuid import UUID

from openapi_schema_pydantic.v3.v3_1_0.schema import Schema
from pydantic import (
UUID1,
UUID3,
Expand Down Expand Up @@ -51,6 +50,7 @@
SHAPE_TUPLE,
SHAPE_TUPLE_ELLIPSIS,
)
from pydantic_openapi_schema.v3_1_0.schema import Schema

from starlite.openapi.enums import OpenAPIFormat, OpenAPIType

Expand Down
2 changes: 1 addition & 1 deletion starlite/openapi/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from starlite.handlers import get

if TYPE_CHECKING:
from openapi_schema_pydantic.v3.v3_1_0.open_api import OpenAPI
from pydantic_openapi_schema.v3_1_0.open_api import OpenAPI


class OpenAPIController(Controller):
Expand Down
4 changes: 2 additions & 2 deletions starlite/openapi/parameters.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from copy import copy
from typing import TYPE_CHECKING, Any, Dict, List, cast

from openapi_schema_pydantic.v3.v3_1_0.parameter import Parameter
from pydantic.fields import Undefined
from pydantic_openapi_schema.v3_1_0.parameter import Parameter

from starlite.constants import (
EXTRA_KEY_IS_PARAMETER,
Expand All @@ -14,9 +14,9 @@
from starlite.openapi.schema import create_schema

if TYPE_CHECKING:
from openapi_schema_pydantic.v3.v3_1_0.schema import Schema
from pydantic import BaseModel
from pydantic.fields import ModelField
from pydantic_openapi_schema.v3_1_0.schema import Schema

from starlite.handlers import BaseRouteHandler
from starlite.provide import Provide
Expand Down
4 changes: 2 additions & 2 deletions starlite/openapi/path_item.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import TYPE_CHECKING, List, Optional, cast

from openapi_schema_pydantic.v3.v3_1_0.operation import Operation
from openapi_schema_pydantic.v3.v3_1_0.path_item import PathItem
from pydantic_openapi_schema.v3_1_0.operation import Operation
from pydantic_openapi_schema.v3_1_0.path_item import PathItem
from starlette.routing import get_name

from starlite.openapi.parameters import create_parameter_for_handler
Expand Down
4 changes: 2 additions & 2 deletions starlite/openapi/request_body.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import TYPE_CHECKING, List, Optional

from openapi_schema_pydantic.v3.v3_1_0.media_type import (
from pydantic_openapi_schema.v3_1_0.media_type import (
MediaType as OpenAPISchemaMediaType,
)
from openapi_schema_pydantic.v3.v3_1_0.request_body import RequestBody
from pydantic_openapi_schema.v3_1_0.request_body import RequestBody

from starlite.enums import RequestEncodingType
from starlite.openapi.schema import create_schema, update_schema_with_field_info
Expand Down
10 changes: 5 additions & 5 deletions starlite/openapi/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
from inspect import Signature
from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional, Tuple, Type, cast

from openapi_schema_pydantic.v3.v3_1_0.header import Header
from openapi_schema_pydantic.v3.v3_1_0.media_type import (
from pydantic_openapi_schema.v3_1_0.header import Header
from pydantic_openapi_schema.v3_1_0.media_type import (
MediaType as OpenAPISchemaMediaType,
)
from openapi_schema_pydantic.v3.v3_1_0.response import Response
from openapi_schema_pydantic.v3.v3_1_0.schema import Schema
from pydantic_openapi_schema.v3_1_0.response import Response
from pydantic_openapi_schema.v3_1_0.schema import Schema
from starlette.routing import get_name

from starlite.datastructures import File, Redirect, Stream, Template
Expand All @@ -19,8 +19,8 @@
from starlite.utils.model import create_parsed_model_field

if TYPE_CHECKING:
from openapi_schema_pydantic.v3.v3_1_0.responses import Responses
from pydantic.typing import AnyCallable
from pydantic_openapi_schema.v3_1_0.responses import Responses

from starlite.handlers import HTTPRouteHandler
from starlite.plugins.base import PluginProtocol
Expand Down
Loading

0 comments on commit 1b34eaa

Please sign in to comment.