Code Monkey home page Code Monkey logo

Comments (15)

rochacbruno avatar rochacbruno commented on May 13, 2024

@njarvis Is your view under a blueprint? I am trying to fix this in #59

from flasgger.

njarvis avatar njarvis commented on May 13, 2024

We don't use blueprint just "vanilla" flask.

from flasgger.

rochacbruno avatar rochacbruno commented on May 13, 2024

@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.

rochacbruno avatar rochacbruno commented on May 13, 2024

I made a change in 745d017 that might fix this one, please test it and let me know if solved. thanks.

from flasgger.

njarvis avatar njarvis commented on May 13, 2024

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.

rochacbruno avatar rochacbruno commented on May 13, 2024

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.

rochacbruno avatar rochacbruno commented on May 13, 2024

Ok, got it!

83d2291

/lib was on /gitignore my bad.. please try update your local repo and try again :)

from flasgger.

njarvis avatar njarvis commented on May 13, 2024

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.

njarvis avatar njarvis commented on May 13, 2024

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.

screen shot 2017-03-29 at 19 39 01

from flasgger.

njarvis avatar njarvis commented on May 13, 2024

From error console after rendering the page:

screen shot 2017-03-29 at 19 43 20

from flasgger.

rochacbruno avatar rochacbruno commented on May 13, 2024

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.

rochacbruno avatar rochacbruno commented on May 13, 2024

I want to solve this before releasing next version to PyPI but I am not able to reproduce it.

from flasgger.

rochacbruno avatar rochacbruno commented on May 13, 2024

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.

njarvis avatar njarvis commented on May 13, 2024

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.

rochacbruno avatar rochacbruno commented on May 13, 2024

@njarvis

Nice! this is fixed!

  1. OpenAPIspec always expected produces and consumes to be a list, the problem is that in 0.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.

  1. I changed the way references are created, before it was {function_name}_{http_method}_{schema_id} so it generated the get_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 as definitions 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)

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.