Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple fixes and improvements #244

Merged
merged 8 commits into from
Aug 4, 2021
Merged

Multiple fixes and improvements #244

merged 8 commits into from
Aug 4, 2021

Conversation

ahopkins
Copy link
Member

@ahopkins ahopkins commented Aug 3, 2021

  1. Fixes [Bug] Even after excluding an endpoint from doc, it still shows the route on swagger, although not the contents of it. #240
  2. Fixes Can't handle duplicate path #239
  3. Adds exclude to OAS3
  4. Adds openapi.definition decorator to OAS3
  5. Adds support for reading from annotated class models
  6. Adds specification.raw() method to OAS3 for adding specs directly

Here is an example of how the definition decorator could be used:

class Name:
    first_name: str
    last_name: str


class User:
    name: Name


@app.post("/path")
@openapi.definition(
    operation="opeID",
    summary="This is a summary",
    description="This is a description",
    tag=["one", "two"],
    document="http://127.0.0.1:9999/doc",
    # body=RequestBody(content=User),
    body=RequestBody(User, True, "Hello"),
    # body=RequestBody({"application/json": {"name": str}}),
    # body={"*/*": User},
    parameter=Parameter("foo", int),
    # parameter={"required": True, "name": "something"},
    response=[
        Response(User, status=201),
        Response(Name, status=400),
    ],
    # response={"application/json": User
)
async def post_test(request):
    return json({"hello": "world"})

@ahopkins ahopkins requested a review from artcg August 3, 2021 11:20
@ahopkins ahopkins marked this pull request as draft August 3, 2021 11:20
@ahopkins ahopkins marked this pull request as ready for review August 3, 2021 21:07
@ahopkins ahopkins requested a review from a team August 3, 2021 21:07
@artcg
Copy link
Contributor

artcg commented Aug 4, 2021

👍 nice thanks for that, looks like some good changes, nice to see some more robust tests as well

@ahopkins ahopkins merged commit 65547bc into main Aug 4, 2021
@ahopkins ahopkins deleted the improvements branch August 4, 2021 12:45
@ahopkins ahopkins restored the improvements branch August 15, 2021 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants