Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Briefly describe arguments formodel.model_dump()#11562

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Viicos merged 4 commits intopydantic:mainfromcmenon12:cmenon12-serialization-docs
Mar 19, 2025
Merged

Briefly describe arguments formodel.model_dump()#11562

Viicos merged 4 commits intopydantic:mainfromcmenon12:cmenon12-serialization-docs
Mar 19, 2025

Conversation

cmenon12
Copy link
Contributor

@cmenon12cmenon12 commentedMar 15, 2025
edited by pydantic-hookybot
Loading

Change Summary

Briefly describe the arguments available formodel.model_dump() in theSerialization concept docs, particularly about themode argument.

Also make a couple of small grammar/consistency tweaks.

Related issue number

None - this is just a small change to the docs.

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review,please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer:@sydney-runkle

@hyperlint-aiHyperlint AI
Copy link
Contributor

PR Change Summary

Updated documentation formodel.model_dump() to clarify the available arguments, particularly themode argument, and made minor grammatical adjustments for consistency.

  • Described themode argument in the context ofmodel.model_dump() for better clarity.
  • Added a note about JSON serialization in the serialization documentation.
  • Improved consistency in terminology related to arguments in the documentation.

Modified Files

  • docs/concepts/serialization.md

How can I customize these reviews?

Check out theHyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add thehyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to addhyperlint-ignore to the PR to ignore the link check for this PR.

What is Hyperlint?

Hyperlint is an AI agent that helps you write, edit, and maintain your documentation.

Learn more about theHyperlint AI reviewer and the checks that we can run on your documentation.

@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commentedMar 15, 2025
edited
Loading

Coverage report

This PR does not seem to contain any modification to coverable code.

@codspeed-hqCodSpeed HQ
Copy link

codspeed-hqbot commentedMar 15, 2025
edited
Loading

CodSpeed Performance Report

Merging#11562 willdegrade performances by 6.69%

Comparingcmenon12:cmenon12-serialization-docs (83a4fca) withmain (a2846da)

Summary

❌ 1 regressions
✅ 45 untouched benchmarks

⚠️Please fix the performance issues oracknowledge them on CodSpeed.

Benchmarks breakdown

BenchmarkBASEHEADChange
test_model_validators_serializers767.7 µs822.7 µs-6.69%

@cmenon12
Copy link
ContributorAuthor

please review

pydantic-hooky[bot] reacted with thumbs up emoji

Copy link
Member

@ViicosViicos left a comment

Choose a reason for hiding this comment

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

Thanks, a couple changes

@@ -104,7 +108,7 @@ print(Model(x=['{"a": 1}', '[1, 2]']).model_dump(round_trip=True))
The `.model_dump_json()` method serializes a model directly to a JSON-encoded string
that is equivalent to the result produced by [`.model_dump()`](#modelmodel_dump).

See [arguments][pydantic.main.BaseModel.model_dump_json] for more information.
Seethe available[arguments][pydantic.main.BaseModel.model_dump_json] for more information.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
See the available[arguments][pydantic.main.BaseModel.model_dump_json] for more information.
See the available[parameters][pydantic.main.BaseModel.model_dump_json] for more information.

@@ -21,6 +21,10 @@ serialized, and exported in a number of ways.

This is the primary way of converting a model to a dictionary. Sub-models will be recursively converted to dictionaries.

By default, the output may contain non-JSON-serializable Python objects. The `mode` argument can be specified as `"json"` to ensure that the output only contains JSON serializable types. Other arguments exist to include or exclude fields, [including nested fields](#advanced-include-and-exclude), or to further customize the serialization behaviour.

See the available [arguments][pydantic.main.BaseModel.model_dump] for more information.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
See the available[arguments][pydantic.main.BaseModel.model_dump] for more information.
See the available[parameters][pydantic.main.BaseModel.model_dump] for more information.

@@ -839,7 +843,7 @@ print(t.model_dump(include={'id': True, 'value': True})) # (1)!
1. `value` excluded from the output because it excluded in `Field`.

That being said, setting `exclude` on the field constructor (`Field(exclude=True)`) does not take priority
over the `exclude_unset`, `exclude_none`, and `exclude_default`parameters on `model_dump` and `model_dump_json`:
over the `exclude_unset`, `exclude_none`, and `exclude_default`arguments on `model_dump` and `model_dump_json`:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
over the`exclude_unset`,`exclude_none`, and`exclude_default`arguments on`model_dump` and`model_dump_json`:
over the`exclude_unset`,`exclude_none`, and`exclude_default`parameters on`model_dump` and`model_dump_json`:

@cmenon12
Copy link
ContributorAuthor

Thank you for the review@Viicos! I've replaced some (but not all) occurrences of "argument" with "parameter", including those you described.

@cmenon12cmenon12 requested a review fromViicosMarch 18, 2025 20:50
@ViicosViicosenabled auto-merge (squash)March 19, 2025 10:16
@Viicos
Copy link
Member

Thanks for the contribution

cmenon12 reacted with thumbs up emoji

@ViicosViicos merged commit7b8fd9a intopydantic:mainMar 19, 2025
61 of 62 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ViicosViicosViicos approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@cmenon12@Viicos

[8]ページ先頭

©2009-2025 Movatter.jp