Skip to content

docs: fix Decimal field prose to reference Field() instead of condecimal()#2035

Open
anxkhn wants to merge 1 commit into
fastapi:mainfrom
anxkhn:patch-1
Open

docs: fix Decimal field prose to reference Field() instead of condecimal()#2035
anxkhn wants to merge 1 commit into
fastapi:mainfrom
anxkhn:patch-1

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 7, 2026

Copy link
Copy Markdown

The "Decimals in SQLModel" section introduces its example like this:

We could make that field a Decimal type using the condecimal() function:

but the example it introduces (and current SQLModel) uses Field():

money: Decimal = Field(default=0, max_digits=5, decimal_places=3)

So the sentence contradicts the code sample that immediately follows it, and it also disagrees with the paragraph just above it, which already says the number of digits and decimal places are specified "in the Field() function".

condecimal() is a Pydantic v1 constrained-type helper. SQLModel does not re-export it, and using it as a type annotation trips static type checkers; this is what a user hit in #354 ("Illegal type annotation: call expression not allowed"). The Field(max_digits=..., decimal_places=...) form the example already uses is the type-checker-clean way, and it is what the rest of the page describes.

This PR rewords that one sentence so the prose matches both the surrounding text and the sample:

We could make that field a Decimal type and set the number of digits and decimal places in the Field() function:

Docs-only, one line changed, no code touched.

Reference

Related issue: #354.

…mal()

The 'Decimals in SQLModel' section introduced its example with 'using
the condecimal() function', but the example (and current SQLModel) uses
Field(max_digits=..., decimal_places=...). condecimal() is a Pydantic v1
constrained-type helper that SQLModel does not re-export, and using it as
an annotation trips static type checkers.

Reword the sentence to match the paragraph above it and the code sample,
both of which already use Field().

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@github-actions github-actions Bot added the docs Improvements or additions to documentation label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📝 Docs preview

Last commit 884053d at: https://b0285440.sqlmodel.pages.dev

Modified Pages

@YuriiMotov

Copy link
Copy Markdown
Member

@anxkhn, the description is too verbose for such small fix..
Have you self-reviewed it before posting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants