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

Support OpenAPI 3 #40

Open
skyline-gleb opened this issue Nov 24, 2017 · 9 comments
Open

Support OpenAPI 3 #40

skyline-gleb opened this issue Nov 24, 2017 · 9 comments

Comments

@skyline-gleb
Copy link

Hi!
It is planned to support a new version?
Now, with app:

from aiohttp import web
from aiohttp_swagger import *


async def ping(request):
    return web.Response(text="pong")

app = web.Application()
app.router.add_route('GET', "/ping", ping)
setup_swagger(app, swagger_from_file="swagger.yaml")
web.run_app(app, host="127.0.0.1")

and swagger.yaml:

---

openapi: 3.0.0
info:
  title: API
  description: description
  version: 0.1.9

paths:
  /ping:
    get:
      responses:
        '200':
          description: return "pong"

i get an error (in browser console):

Uncaught TypeError: Cannot read property 'definitions' of null
    at module.exports.Resolver.resolve (swagger-ui.js:4566)
    at swagger-ui.js:3596
    at module.exports.SwaggerSpecConverter.finish (swagger-ui.js:6592)
    at module.exports.SwaggerSpecConverter.convert (swagger-ui.js:5966)
    at response (swagger-ui.js:3594)
    at responseInterceptor (swagger-ui.js:4211)
    at obj.on.response (swagger-ui.js:4226)
    at swagger-ui.js:4489
    at Request.callback (swagger-ui.js:20775)
    at Request.<anonymous> (swagger-ui.js:20597)

Use aiohttp-swagger version 1.0.5

@kamikaze
Copy link

kamikaze commented Feb 1, 2018

yes, please add support

@motinani
Copy link

+1

3 similar comments
@Valian
Copy link

Valian commented Apr 4, 2018

+1

@levkovskyi
Copy link

+1

@Chris-hughes10
Copy link

+1

@agronholm
Copy link

@Gronis
Copy link

Gronis commented Aug 20, 2020

Use ui_version=3 to use open api v3 instead of swagger v2.

setup_swagger(app, ui_version=3)

@kamikaze
Copy link

Use ui_version=3 to use open api v3 instead of swagger v2.

setup_swagger(app, ui_version=3)

have you tried to use swagger ui after that? It doesn't work with ui_version 3

@Gronis
Copy link

Gronis commented Aug 21, 2020

have you tried to use swagger ui after that? It doesn't work with ui_version 3

Yes, I can use swagger ui after that. However, I specify more arguments than in my initial answer, maybe that is needed for the ui to work?

setup_swagger(api,
              title="My API",
              ui_version=3,
              swagger_url="/doc",
              description="API definition for My API",
              api_version="1.0.0",
              definitions=definitions,
              api_base_url='/api/v1',

definitions is a dict with model schemas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants