Comments (9)
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.
Hi,
im running django 1.11.7 ,drf 3.7.7 on a python version 3.6.2.
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.
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.
Ah now i got it.
here is the spec:
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.
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.
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.
Hello,
I think I have some ideas:
- your (terminal) pattern should end in $ - so
r'^myendpoint/(?P<pk>[0-9]+)$'
instead ofr'^myendpoint/(?P<pk>[0-9]+)'
- if you are manually providing a
url
toget_schema_view
, it should be an absolute url with protocol -http://localhost:8000/
instead oflocalhost:8000/
from drf-yasg.
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.
Re-opening to remember to improve handling of this.
from drf-yasg.
Related Issues (20)
- get_schema_fields breaks when using django-filters after last update HOT 2
- Redirect URL is not being processed in Django 4.2 when using oauth2 implicit flow HOT 1
- coreschema does not get installed with 1.21.6 HOT 4
- Can I use swagger_auto_schema in generic views?
- Vulnerability Issue
- `SerializerMethodField` return type is always 'STRING' when a file uses `from __future__ import annotations` due to PEP 563 HOT 2
- Animation not working on brave browser
- swagger_serializer_method does not work with partialmethod
- Headers Not Getting Sent Along with Request!
- Wrong Base URL: localhost HOT 2
- Add Python 3.12 Support HOT 3
- from pkg_resources import DistributionNotFound, get_distribution `ModuleNotFoundError: No module named 'pkg_resources`
- Export enums with drf-yasg to Swagger: Works in responses serializers but not in query_serializer
- Showing the read_only fields in the serializer in the post /swagger template in (ForignKeyFields)
- Django5 not supported? HOT 1
- tags hierarchy (sub-tags grouping)
- How can i remove default urls generated by base_url of router from swagger ui ??
- django_filters is not compatible
- Login with JWT
- filters.ModelChoiceFilter not looks like filters.ChoiceFilter 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 drf-yasg.