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

docs: mention id field in 1-abstract-dto.rst #3803

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sobolevn
Copy link
Member

It caught my attention that it was never explained: why do we have an extra id field in the response. Since this part is dedicated to explaining how request / response fields are marked, I think that it is important to mention that id is special:
Снимок экрана 2024-10-15 в 18 50 23

I had to grep what .my_lib is and how class _Base(CommonTableAttributes, UUIDPrimaryKey, DeclarativeBase): is constructed. Only finding UUIDPrimaryKey and its id: Mapped[UUID] = mapped_column(default=uuid4, primary_key=True) has anwsered my question :)

@sobolevn sobolevn requested review from a team as code owners October 15, 2024 15:52
@github-actions github-actions bot added area/docs This PR involves changes to the documentation size: small type/docs pr/external Triage Required 🏥 This requires triage labels Oct 15, 2024
Copy link

sonarcloud bot commented Oct 15, 2024

Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3803

@provinzkraut
Copy link
Member

I'm not really sure "special" is the right wording here, since it's simply an inherited attribute. It only happens to be the only one that's inherited from the base class, but there's nothing special about the id attribute itself

@sobolevn
Copy link
Member Author

@provinzkraut can we say that "id is readonly because it is a primary key"?

@provinzkraut
Copy link
Member

@provinzkraut can we say that "id is readonly because it is a primary key"?

I think it should say something like "we mark id read only since it represents a primary key", to emphasize that this isn't done automagically, and could apply to other arbitrary fields as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs This PR involves changes to the documentation pr/external size: small Triage Required 🏥 This requires triage type/docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants