Giter Club home page Giter Club logo

bottle-swagger's People

Contributors

ampedandwired avatar m4droid avatar robin-norwood avatar rpcope1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bottle-swagger's Issues

Support a structure similar to express-openapi

I really like how express-openapi allows you to put your data structure definitions and security definitions in one place, and then place the swagger specification for the routes themselves together with the route implementation. It would be nice to do something similar with this (instead of having one massive Swagger file).

Items to do:

  • Can this be done nicely with what's already here, without major modifications?
  • Can this be done in a relatively Pythonic way?
  • Proof of Concept

Swagger UI integration

As a developer consuming this plugin, I would like to have an easy way to incorporate Swagger UI, so that I have ready to go API documentation without having to work too hard.

ignore_undefined_routes should be able to be scoped to certain paths.

So, by default ignore_undefined_routes either filters everything that is not in the swagger spec (if it's set to true), or ignores everything if it is set to false. As a developer consuming this plugin, I want to be able to set one or more suburls to trigger the undefined route handler, so that I can potential use this plugin concurrently with other Swagger APIs or other non-Swagger routes, but have nice behavior for all sub-URLs known to belong to this specific Swagger instance.

Easy Authentication Support

As a developer consuming this plugin, I would like to be able to have relatively easy authentication support, similar to what Connexion or express-openapi provide, so that it's easy and intuitive to add authentication to an application using this plugin.

Enhance Documentation and Example Applications

The single example application is a little rough, and I've now watched someone else (not naming names) look at it, and come away somewhat confused how to consume this library. Adding a few example applications with some diversity would be good, as well as fixing the one that's already there and adding some more documentation about how to consume the library.

swagger.json is always served (even when it is supposed to be disabled)

From @ereboschi:

Looks like 2.0.6 fixes the exception. Much obliged.

Unfortunately, I just discovered that the SwaggerPlugin(serve_swagger_schema=False) doesn't work if serve_swagger_ui=True... Bottle still serves up /swagger.json (because self.serve_swagger_schema = serve_swagger_schema or serve_swagger_ui)... but I can open a second bug for that.

Thank you.

The fix should make swagger.json not be served when disabled (and frankly also check to make sure the built-in UI is not served when disabled), and provide some satisfactory tests to verify this behavior.

SwaggerPlugin(serve_swagger_schema=False) causes exception

Problem:
Calling SwaggerPlugin with serve_swagger_schema=False causes an exception due to a bug in SwaggerPlugin.__init__():

My Code:

        bottle.install(SwaggerPlugin(
            swagger_def=swagger_dict,
            serve_swagger_ui=True,
            swagger_ui_suburl='/swagger/',
            serve_swagger_schema=False))  # We want to serve swagger.json ourselves, so we can set host dynamically

Exception: AttributeError: 'SwaggerPlugin' object has no attribute 'serve_swagger_ui'

Explanation:
SwaggerPlugin.__init__():

        ...
        self.serve_swagger_schema = serve_swagger_schema or self.serve_swagger_ui
        self.serve_swagger_ui = serve_swagger_ui
        ...

... self.serve_swagger_ui is undefined on the first line, because that value isn't set until the second line. Apparently, this isn't a problem for most people, because the default value of serve_swagger_schema is True, so the second half of the or statement is never evaluated (short-circuit).

This can be solved by changing the order of these lines. (Which would allow me to serve up swagger.json myself.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.