OpenAPI Schema generation missing titlte

2017-08-28 Thread Dan Davis
Hi guys, 

I'm trying to understand what I would need to do to get the schema 
generation to include verbose_name from my model or a label from a 
serializer form.  I'm converting the schema all the way through to to try 
to drive a React schema-driven form using the javascript package 
reach-jsonschema-form, playground for which 
is https://mozilla-services.github.io/react-jsonschema-form/.

However, the OpenAPI schema generated does not include a label for a field, 
whether I specify it as the verbose_name on my model, or as the label on 
Serializer.   

I've tried to look at the CoreAPI intermediate form, for which I post the 
following:

Field(name='barcode', required=True, location='form', 
schema=, 
description=None, type=None, example=None)
Field(name='universal_sequence', required=True, location='form', 
schema=, 
description=None, type=None, example=None)
Field(name='index_sequence', required=True, location='form', 
schema=, 
description=None, type=None, example=None)
Field(name='full_sequence', required=True, location='form', 
schema=, 
description=None, type=None, example=None)
Field(name='index_type', required=True, location='form', 
schema=, 
description=None, type=None, example=None)


You can see some of the Python from which I produced this brief result in a 
Gist - https://gist.github.com/danizen/6f441f575d04258329d65ba25ec2ea74

If you need more, the whole code is in GitHub - 
https://github.com/NCBI-Hackathons/OnlineAdapterDatabase/tree/dan/tryreact


I'm posting here because I've eliminated django-rest-swagger from the tools 
- the API is using purely Django rest framework, with a custom renderer 
based on the openapi_codec package, as shown in the Django Rest Framework 
documentation.   I've come a long way in understanding how CoreAPI is an 
sometimes internal view, but a schema view can be made external.   I've 
made that an operation on a ViewSet so that it can be browsed through the 
API explorer itself.

The problem here is getting it to include the title for a form...

-- 
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 django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Ignore authentication on a single list_route within ViewSet?

2017-01-04 Thread Dan
Hi everyone,


I am trying to figure out how to remove authentication from a single view 
within a ViewSet. I essentially want this endpoint to be public, but not 
effect any other view in here.

In settings.py I have:
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'oauth2_provider.ext.rest_framework.OAuth2Authentication',
),

'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),...
}


My ViewSet is just a basic viewsets.ViewSet with no decorators or variables 
being modified on the class.

In this ViewSet I have the following view:
@list_route(methods=['GET'], url_path='package/(?P[^\/]+)')
def get_package(self, request, package_id):


I have tried just about every possible combination 
of @authentication_classes() and @permission_classes() decorators, trying 
different orders too, and no matter what I get:
{
  "detail": "Authentication credentials were not provided."
}

I've even tried making my own authentication class:
class NoAuthentication(BaseAuthentication):
def authenticate(self, request):
return True


def authenticate_header(self, request):
pass

And then using it as such:
@list_route(methods=['GET'], url_path='package/(?P[^\/]+)')
@authentication_classes([NoAuthentication, ])
@permission_classes([AllowAny, ])
def get_package(self, request, package_id):
Which does a whole lot of nothing.


Removing this view from the ViewSet is a last resort as I'd rather not have 
to hard-code a URL that mimics the ViewSet's route. I would really like to 
know why I can't disable auth on a single view.


Any help here would be much appreciated!


Thanks
Dan

-- 
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 django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.