Comments (3)
IMO, your current solution seems like the most reasonable way to accomplish this. Defining the base securityDefinitions
inside of your docstrings does not fully make sense, as they should only be defined once at the base and then referenced inside your docstrings.
In that case, some clarification/examples in the docs might help. If this is insufficient for your needs, can you elaborate more on how you would like to see this working?
from flask-swagger.
The current solution is perfectly fine for me. But what I had in my mind, was to extract these securityDefinitions
from the docstrings of any method to the top level, just like what is currently being done for definitions
. Do you think this makes sense?
from flask-swagger.
Thanks @SandhyaGiri this definitely makes sense. I think I'm just trying to reason about conflict resolution in the event that there are two different security definitions with the same name. For example:
@app.route('/reports', methods=["POST"])
def sample_meth():
"""
docstring
---
securityDefinitions:
ApiKeyAuth:
type: apikey
in: header
name: X-API-Key
and then another view:
@app.route('/reports', methods=["POST"])
def sample_meth():
"""
docstring
---
securityDefinitions:
ApiKeyAuth:
type: apikey
in: header
name: X-API-Key-Different-Header
In this case, which definition would we expect to see in securityDefinitions
? More importantly, which one would be used for the view?
The thing I like about your solution is that there is one and only one way to define the security definitions.
It looks like definitions
gets handled by requiring an ID, so we could consider doing something similar with securityDefinitions
if we want to.
from flask-swagger.
Related Issues (20)
- Doc example showing root level definitions? HOT 1
- Are Blueprint supported ? HOT 9
- Pip source code is different from github master branch HOT 2
- Multiple path parameters and multiple endpoints HOT 3
- Add partial substitution of docstrings -- expansion of .yml file support HOT 5
- Spec throws exception on bad yaml HOT 1
- Swagger UI v3 HOT 2
- Support resuableParameters
- yaml file location HOT 2
- Support flask blueprint
- Passing Absolute YAML Path In Windows HOT 1
- pip install missing packages
- Supported methods to authenticate and cache web token
- AttributeError: type object 'Create' has no attribute 'lower' HOT 1
- TypeError: swagger() got an unexpected keyword argument 'base_path'
- Type annotations / type hints / stub files for mypy HOT 4
- [Question] Can I check flask-swagger comments for correctnes?
- 'base_path' argument error HOT 3
- Invalid path parameter HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-swagger.