We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
master
# view.py from rest_framework import generics from rest_framework import serializers from django.db import models class Book(models.Model): title = models.CharField(max_length=200) class BookSerializer(serializers.ModelSerializer): tags = serializers.ListField(min_length=2, max_length=5) class Meta: model = Book fields = ('tags',) class BooksView(generics.ListAPIView): queryset = Book.objects.all() serializer_class = BookSerializer # urls.py urlpatterns = [ ... path('api/books/', views.BooksView.as_view()), ... ]
$ ./manage.py generateschema openapi: 3.0.2 info: title: '' version: TODO paths: /api/books/: get: operationId: ListBooks parameters: [] responses: '200': content: application/json: schema: required: - tags properties: tags: type: array items: {} maxItems: 5 minItems: 2
$ ./manage.py generateschema openapi: 3.0.2 info: title: '' version: TODO paths: /api/books/: get: operationId: ListBooks parameters: [] responses: '200': content: application/json: schema: required: - tags properties: tags: type: array items: {} maxLength: 5 minLength: 2
https://swagger.io/docs/specification/data-models/data-types/#array-length
The text was updated successfully, but these errors were encountered:
@carltongibson please confirm whether this is something you'd like me to work on 🙂 There's one more #6863
Sorry, something went wrong.
Hi @knivets I’m struggling to spot the difference between the actual and expected here. Could you ping it out for me please? (Sorry)
Oh, items vs length. Right.
Yes, I guess we need an adjustment here, after mapping validators. (Grrrr. Messy spec. Grrrr. 🙂)
Successfully merging a pull request may close this issue.
Checklist
master
branch of Django REST framework.Steps to reproduce
Expected behavior
Actual behavior
https://swagger.io/docs/specification/data-models/data-types/#array-length
The text was updated successfully, but these errors were encountered: