Skip to content

Commit

Permalink
OpenAPI: Rename module from schema to openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Oct 26, 2024
1 parent fe5b44b commit 6c2c6b4
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions docs/source/tour.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ You can make use of Responder's Request and Response objects in your GraphQL res

OpenAPI Schema Support
----------------------

Responder comes with built-in support for OpenAPI / marshmallow::

pip install 'responder[openapi]'

New in Responder `1.4.0`::

import responder
from responder.ext.schema import Schema as OpenAPISchema
from responder.ext.openapi import OpenAPISchema
from marshmallow import Schema, fields

contact = {
Expand Down Expand Up @@ -200,12 +199,11 @@ Responder can automatically supply API Documentation for you. Using the example

The new and recommended way::

...
from responder.ext.schema import Schema
...
from responder.ext.openapi import OpenAPISchema

api = responder.API()

schema = Schema(
schema = OpenAPISchema(
app=api,
title="Web Service",
version="1.0",
Expand All @@ -220,7 +218,7 @@ The new and recommended way::
)

The old way ::
The old way::

api = responder.API(
title="Web Service",
Expand Down
2 changes: 1 addition & 1 deletion responder/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__(
self.add_middleware(SessionMiddleware, secret_key=self.secret_key)

if openapi or docs_route:
from .ext.schema import OpenAPISchema
from .ext.openapi import OpenAPISchema

self.openapi = OpenAPISchema(
app=self,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/test_responder.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def test_schema_generation_explicit(needs_openapi):
import marshmallow

import responder
from responder.ext.schema import OpenAPISchema
from responder.ext.openapi import OpenAPISchema

api = responder.API()

Expand Down Expand Up @@ -394,7 +394,7 @@ def test_documentation_explicit(needs_openapi):
import marshmallow

import responder
from responder.ext.schema import OpenAPISchema
from responder.ext.openapi import OpenAPISchema

description = "This is a sample server for a pet store."
terms_of_service = "http://example.com/terms/"
Expand Down

0 comments on commit 6c2c6b4

Please sign in to comment.