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

Primary key field should not be nullable #1778

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

LanceMoe
Copy link
Contributor

@LanceMoe LanceMoe commented Nov 18, 2024

Primary key field should not be nullable

Description

If a value is a primary key, it should not be optional(nullable). For example, there is a Model called Foo, whose primary key is a UUIDField called id. Submitting a form using FooIn will use exclude_readonly=True, so the id field will not be included. And for output FooOut id cannot be nullable because it is the primary key. This PR fixes this problem.

Before:
image

After:
image

Motivation and Context

My projects use OpenAPI documentation auto-generated as a TypeScript client. It helps a lot to annotate the types correctly.

How Has This Been Tested?

This is a minor change, and it passes all existing tests. I tested it in a few of my live projects and it works fine.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@coveralls
Copy link

coveralls commented Nov 19, 2024

Pull Request Test Coverage Report for Build 11903355177

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 89.255%

Totals Coverage Status
Change from base Build 11887821450: 0.001%
Covered Lines: 6224
Relevant Lines: 6857

💛 - Coveralls

@abondar abondar merged commit 762fe37 into tortoise:develop Nov 19, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

3 participants