Skip to content

Commit

Permalink
fix openapi (#17)
Browse files Browse the repository at this point in the history
* add openapi validation test

* fix openapi

Co-authored-by: Yifan Zhang <[email protected]>
  • Loading branch information
yifan and Yifan Zhang authored Jan 5, 2023
1 parent 5576c71 commit dce8ad4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apihub/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ def extract_components(schema, components):
def get_paths(redis=get_redis()):
paths = {}
components_schemas = {}
security_schemes = {}
security_schemes = {
"BasicAuth": {
"type": "http",
"scheme": "basic",
}
}
definitions = DefinitionManager(redis=redis)

for name, definition in definitions.get_all():
Expand Down Expand Up @@ -386,7 +391,7 @@ def custom_openapi(app=api):
paths, components_schemas, security_schemes = get_paths()
openapi_schema["paths"].update(paths)
openapi_schema["components"]["schemas"].update(components_schemas)
openapi_schema["components"]["securitySchemes"] = security_schemes
openapi_schema["components"]["securitySchemes"].update(security_schemes)

app.openapi_schema = openapi_schema
return app.openapi_schema
Expand Down

0 comments on commit dce8ad4

Please sign in to comment.