Giter Club home page Giter Club logo

Comments (9)

axnsan12 avatar axnsan12 commented on June 22, 2024

Hello @chgad,

Does the "try it out" function work from the web UI? (I.e. is it just the curl URL which has problems?)

I tried, but can't manage to reproduce the issue. What python/rest-framework/Django versions are you using? Can you provide the generated swagger.yaml or .json spec for your api, or a minimal example which exhibits the issue?

Thanks.

from drf-yasg.

chgad avatar chgad commented on June 22, 2024

Hi,

im running django 1.11.7 ,drf 3.7.7 on a python version 3.6.2.

swagger_wrong_curl

This is a screenshot of the wrong behavior. Im not sure what your saying about the .json/.yaml spec ? hwo would this help ?

from drf-yasg.

axnsan12 avatar axnsan12 commented on June 22, 2024

I'm trying to figure out what happens, as I said, I can't manage to reproduce it. The json/yaml spec is the source of the documentation - you can get it by accessing ?format=openapi, or by using schema_view.without_ui().

Back to your problem, are you by any chance using path() instead of url() for routing your urls?

Does the app itself work?

from drf-yasg.

chgad avatar chgad commented on June 22, 2024

Ah now i got it.

here is the spec:

e_flfA5q.txt

Nope i'm not using path() and yes my app works just fine. I can't geive feedback about "live behavior" since the docs aren't online yet.

from drf-yasg.

axnsan12 avatar axnsan12 commented on June 22, 2024

Also how are you instantiating the schema view, and how are you accesing it in the browser? (i.e. the full URL) - it's strange to see that it picks up localhost as the URL scheme.

from drf-yasg.

chgad avatar chgad commented on June 22, 2024

I instatiate it as it's said in the "Getting started", no customization. i acces it via localhost:8000/api/swagger.
All Api Endpoints are nested under api/

from drf-yasg.

axnsan12 avatar axnsan12 commented on June 22, 2024

Hello,

I think I have some ideas:

  • your (terminal) pattern should end in $ - so r'^myendpoint/(?P<pk>[0-9]+)$' instead of r'^myendpoint/(?P<pk>[0-9]+)'
  • if you are manually providing a url to get_schema_view, it should be an absolute url with protocol - http://localhost:8000/ instead of localhost:8000/

from drf-yasg.

chgad avatar chgad commented on June 22, 2024

Yeah!

The Problem was that i declared an incorrect url in the get_schema_view.

I declared localhost:8000/api/ instead of , what you said, http://localhost:8000/api/.

This fact of an absoulute url could be stated in the docs (?). It would definetly clarify it abit to prevent further Problems with the url.

Thanks for the fast and coninuous help.
I close this Issue for now.

from drf-yasg.

axnsan12 avatar axnsan12 commented on June 22, 2024

Re-opening to remember to improve handling of this.

from drf-yasg.

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.