Hi Stefano. 

Parsing the docstring is not yet implemented for OpenAPI schemas. There is 
basic parsing as part of the CoreAPI stuff which could be ported. This wouldn’t 
be hard I’d think, so would be a good opportunity to contribute. 

A couple of points: 
* We’re never going to do anything very complex here. Basic parsing only. Since…
* The automatic schema generation intentionally just covers the core/simple 
cases. Beyond that you’ll need to implement your own introspection logic. (The 
requirements explode otherwise, for which we don’t have the capacity.)
* Our goal is to provide the right hooks to let you override the bits you need. 
If you find you can’t do that, then open an issue. 

HTH.

Kind Regards,

Carlton


> On 28 Aug 2019, at 15:20, Stefano Tranquillini 
> <[email protected]> wrote:
> 
> Hello all
> 
> We are trying to use the schemas and documentation but I can't get the result 
> as I wish.
> 
> I made this dummy class
> 
> class DummyApi(generics.ListCreateAPIView,
>                viewsets.ViewSet):
>     """
>     get: List all the users.
>     post: Create a new user.
>     """
>     serializer_class = LogInputSerializer
> 
> 
> 
>     def get_queryset(self):
>         return [dict(message='ste'), dict(message='fano')]
> 
>     def list(self, request, *args, **kwargs):
>         """
>         I'm list
>         """
>         usernames = "stefano"
>         return Response(usernames)
> 
>     def create(self, request):
>         """
>         I'm creation
>         """
>         usernames = "stefano"
>         return Response(usernames)
>     
> 
> And 
> 
> 
> router = routers.DefaultRouter()
> router.register(r'dummy', views.DummyApi, basename='dummy')
> urlpatterns = [
>     path('', include(router.urls)),
>     path('openapi', get_schema_view(
>         title=" API",
>         description="Testing"),
>          name='openapi-schema')]
> 
> So, when I open the browser I see (where the DOCSTING IS THERE)
> 
> <Auto Generated Inline Image 1.png>\
> 
> And OPTION as well
> 
> <Auto Generated Inline Image 2.png>
> 
> I DON'T SEE THE COMMENT OF THE METHODS CREATE AND LIST
> 
> AND THE SCHEMA  URL IGNORES NAMES AND DOCSTRING.
> 
> 
> <Auto Generated Inline Image 3.png>
> Do you know what I'm missing?
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-rest-framework/c231294a-cfeb-426b-877e-2cfd1cc1dcaf%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-rest-framework/c231294a-cfeb-426b-877e-2cfd1cc1dcaf%40googlegroups.com?utm_medium=email&utm_source=footer>.
> <Auto Generated Inline Image 1.png><Auto Generated Inline Image 2.png><Auto 
> Generated Inline Image 3.png>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/58232DD9-6C81-4CDA-B045-096B0285DD03%40gmail.com.

Reply via email to