Skip to content
New issue

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

How to expose include[] as a query parameters on API schema? #348

Open
erielias opened this issue Feb 7, 2023 · 0 comments
Open

How to expose include[] as a query parameters on API schema? #348

erielias opened this issue Feb 7, 2023 · 0 comments

Comments

@erielias
Copy link

erielias commented Feb 7, 2023

I'm using the drf_yasg library to document my API and it works well for showing the "page" and "per_page" for the List method. However, I noticed it does not display the parameters:

include[]
exclude[]
filter{}
sort[]

I'm using the simple example:

The related LocationSerializer and GroupSerializer are omitted for brevity

`
class User(models.Model):
name = models.TextField()
location = models.ForeignKey('Location')
groups = models.ManyToManyField('Group')

class UserSerializer(DynamicModelSerializer):
class Meta:
model = User
name = 'user'
fields = ("id", "name", "location", "groups")

  location = DynamicRelationField('LocationSerializer')
  groups = DynamicRelationField('GroupSerializer', many=True)

class UserViewSet(DynamicModelViewSet):
serializer_class = UserSerializer
queryset = User.objects.all()

router = DynamicRouter()
router.register('/users', UserViewSet)
`

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant