Comments (15)
@njarvis Is your view under a blueprint? I am trying to fix this in #59
from flasgger.
We don't use blueprint just "vanilla" flask.
from flasgger.
@njarvis ok, I think I found the problem.
Problem is occurring when @swag_from
receives absolute path starting with /
I should fix this later today.
Thanks for reporting
from flasgger.
I made a change in 745d017 that might fix this one, please test it and let me know if solved. thanks.
from flasgger.
It fixes the traceback I reported, but isn't displaying correctly. I see 404s in the access logs:
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:29 +0100] "GET /apidocs/ HTTP/1.1" 200 5049 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:29 +0100] "GET /flasgger_static/lib/object-assign-pollyfill.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:29 +0100] "GET /flasgger_static/lib/jquery-1.8.0.min.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:29 +0100] "GET /flasgger_static/lib/jquery.slideto.min.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:29 +0100] "GET /flasgger_static/lib/jquery.wiggle.min.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:29 +0100] "GET /flasgger_static/lib/jquery.ba-bbq.min.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:29 +0100] "GET /flasgger_static/lib/handlebars-4.0.5.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:30 +0100] "GET /flasgger_static/lib/lodash.min.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:30 +0100] "GET /flasgger_static/lib/backbone-min.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:30 +0100] "GET /flasgger_static/lib/highlight.9.1.0.pack.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:30 +0100] "GET /flasgger_static/lib/highlight.9.1.0.pack_extended.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:30 +0100] "GET /flasgger_static/lib/jsoneditor.min.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:30 +0100] "GET /flasgger_static/lib/marked.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
[gunicorn.access:INFO] 127.0.0.1 - - [29/Mar/2017:19:08:30 +0100] "GET /flasgger_static/lib/swagger-oauth.js HTTP/1.1" 404 233 "http://localhost:8000/apidocs/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
With 0.5.14, I was using Swagger(api, config={...})
. Tried replacing that with Swagger(api)
, but still see the above log entries.
from flasgger.
Ok, looks like you have a problem for accessing static files, are you passing any config which replaces the static path?
what is the output of /apidocs/?json=true
and what is the output of each url
in there?
Lets first see if specs is being generated correclty as JSON
and then find the problem with static_files.
Thanks for your help.
from flasgger.
Ok, got it!
/lib
was on /gitignore
my bad.. please try update your local repo and try again :)
from flasgger.
We're getting closer :)
I'm not doing any explicit configs, just Swagger(app)
I now see one path (of many) being displayed.
http://localhost:8000/apidocs/?json=true
{
"specs": [
{
"endpoint": "apispec_1",
"title": "A swagger API",
"url": "/apispec_1.json",
"version": "1.0.1"
}
],
"title": "Flasgger"
}
And
"definitions": {
# many...
}
"info": {
"description": "API description",
"termsOfService": "Terms of service",
"title": "A swagger API",
"version": "1.0.1"
},
"paths": {
"/api/v0.1/agents/": {
# This one is displayed correctly.
},
# Many more paths that are not displayed
},
"swagger": "2.0"
}
from flasgger.
Don't know if this is related.I also see this artefact in my browser (Safari), after the load/render completes. The text box looks wrong, and I don't think that text "Rendering Swagger UI..." should remain.
from flasgger.
From error console after rendering the page:
from flasgger.
I'll setup a Saucelabs environment to test safari! (I'm on Linux)
Maybe itis because produces
is empty?
If you try:
on yaml file
---
...
produces:
- 'application/json'
Changes something?
from flasgger.
I want to solve this before releasing next version to PyPI but I am not able to reproduce it.
from flasgger.
I need help from people who has mac and safari to run every example in /examples
folder and please see if can reproduce the issue.
from flasgger.
I've debugged further. The problem was with one of my swag definition files. I had
produces:
image/png
and that caused the rendering to stop. The fix was
produces:
- image/png
This was working in 0.5.14 (I suspect this may be a swaggerui issue, not flasgger?)
I'm also seeing a change in reference behaviour, which I don't know if it is expected. Again, maybe a change in swaggerui? For example, I was using a reference like this:
responses:
404:
description: Error
schema:
$ref: '#/definitions/get_version_get_error'
but the reference names have changed. Now I need to use:
responses:
404:
description: Error
schema:
$ref: '#/definitions/error'
from flasgger.
Nice! this is fixed!
- OpenAPIspec always expected
produces
andconsumes
to be alist
, the problem is that in0.5.14
flasgger just ignored that value in pre-validation and maybe swagger UI also ignored.
fixed I included a fix for backwards compatibility, if flasgger founds a string it will convert to list.
- I changed the way references are created, before it was
{function_name}_{http_method}_{schema_id}
so it generated theget_version_get_error
, but I figured out that this is wrong and not in conformity with OpenAPIspec, So the right way to use is having unique names for schemas (maybe pass them asdefinitions
there are some examples/)
However, I know there are many users that may have this problem, so I included an option prefix_ids
so the old behavior can also be used. Check examples/compat.py
Thanks
from flasgger.
Related Issues (20)
- Async/await in Flask 2.0+ breaks due to decorator order
- Using `current_app` instead of `self.app`.
- Handling 302 in api response
- XSS vulnerability on Swagger UI
- Latest version 0.9.7.1 break Marshmallow apispec dumping
- Flasgger Reports Errors on Apache Server but Works Fine on Local
- 0.9.7.1 breaks `template_file` support
- sdist is missing tox.ini
- Switch from `pep8` to `pycodestyle`
- Unable to use import in yaml definitions with relative path
- Unhandled error around self.SCHEMA_TYPES
- Schema with no required fields crashes
- disable swagger route until authorization HOT 3
- How can I protect the swagger endpoints, by making it a child of another existing endpoint? HOT 1
- Flassger support for parameter type:file HOT 3
- Query parameter not getting picked up in `parsed_data` after 0.9.5
- apispec is missing in the run-time requirements in setup.py
- 1 test fails: ModuleNotFoundError: No module named 'flasgger_package'
- Data validation with swag_from doesn't work with OpenAPI 3
- Not serving .js and .css files? HOT 1
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 flasgger.