Skip to content

Exclude callable field defaults from the OpenAPI schema #1167

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Jul 13, 2023
Merged

Exclude callable field defaults from the OpenAPI schema #1167

merged 2 commits into from
Jul 13, 2023

Conversation

arttuperala
Copy link
Contributor

@arttuperala arttuperala commented Jul 12, 2023

Description of the Change

Implements the same sort of callable field.default exclusion that DRF implements, as having a callable field default in the OpenAPI schema results in broken YAML output.

field:
  type: string
  writeOnly: true
  default: !!python/object:rest_framework.fields.CreateOnlyDefault
    default: null

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

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

Thanks for this addition. Well spotted. See my inline comments for some small adjustments.

@sliverc sliverc merged commit b7dd585 into django-json-api:main Jul 13, 2023
@sliverc
Copy link
Member

sliverc commented Jul 13, 2023

Great. Thanks for your work. Merged.

@arttuperala arttuperala deleted the schema-callable-default branch July 14, 2023 04:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants