Skip to content

Use PrimaryKeyRelatedField pkfield in openapi #8315

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

Merged
merged 1 commit into from
Dec 10, 2022

Conversation

wnd-ft
Copy link
Contributor

@wnd-ft wnd-ft commented Dec 30, 2021

Note: Before submitting this pull request, please review our contributing guidelines.

Description

As per the unit test, changed to use pk_field argument when creating schema of PrimaryKeyRelatedField.

This fix isn't the perfect solution, but I couldn't come up with another best idea.

I'm sorry that my English isn't very good.

Ex,

class SampleSerializer(Serializer):
    user_id = serializers.PrimaryKeyRelatedField(queryset=User.objects.all())
    user_id_with_pk_field = serializers.PrimaryKeyRelatedField(queryset=User.objects.all(), pk_field=serializers.UUIDField())

# in docs
Sample:
  type: object
  properties:
    user_id:
      type: integer (or string)
    user_id_with_pk_field:
      type: string
      format: uuid

@wnd-ft wnd-ft marked this pull request as draft December 30, 2021 15:05
@wnd-ft wnd-ft marked this pull request as ready for review December 30, 2021 15:36
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 17, 2022
@auvipy
Copy link
Member

auvipy commented Nov 22, 2022

I will see if this can be merged

@stale stale bot removed the stale label Nov 22, 2022
@auvipy auvipy self-requested a review November 22, 2022 14:13
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rebase this once again please

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw what other / better solution do you have in mind? or you already used that in this PR?

@auvipy auvipy added the Bug label Dec 10, 2022
@auvipy auvipy merged commit b79099f into encode:master Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants