8000 Add error messages for json by Kludex · Pull Request #637 · pydantic/pydantic-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add error messages for json #637

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

Merged
merged 5 commits into from
May 26, 2023
Merged

Conversation

Kludex
Copy link
Member
@Kludex Kludex commented May 26, 2023

Selected Reviewer: @dmontagu

@codspeed-hq
Copy link
codspeed-hq bot commented May 26, 2023

CodSpeed Performance Report

Merging #637 feat/add-error-messages-json (edc373f) will not alter performances.

Summary

🔥 0 improvements
❌ 0 regressions
✅ 121 untouched benchmarks

🆕 2 new benchmarks
⁉️ 0 dropped benchmarks

Benchmarks breakdown

Benchmark main feat/add-error-messages-json Change
🆕 test_int_range N/A 18.6 µs N/A
🆕 test_int_range_json N/A 19.7 µs N/A

@@ -541,8 +541,14 @@ impl ErrorType {
pub fn message_template_json(&self) -> &'static str {
match self {
Self::NoneRequired => "Input should be null",
Self::ListType => "Input should be a valid array",
Self::DataclassType { .. } => "Input should be an object", 8000
Self::DictAttributesType => "Input should be a valid object or instance to extract fields from",
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we explicitly add all of them, or it's fine to have the fallback?

Copy link
Member

Choose a reason for hiding this comment

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

fine to have fallback.

I think this one can be removed add added to the "Input should be an object" message.

@Kludex Kludex marked this pull request as ready for review May 26, 2023 11:43
@Kludex
Copy link
Member Author
Kludex commented May 26, 2023

please review

Copy link
Member
@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

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

otherwise LGTM. Please update.

@@ -541,8 +541,14 @@ impl ErrorType {
pub fn message_template_json(&self) -> &'static str {
match self {
Self::NoneRequired => "Input should be null",
Self::ListType => "Input should be a valid array",
Self::DataclassType { .. } => "Input should be an object",
Self::DictAttributesType => "Input should be a valid object or instance to extract fields from",
Copy link
Member

Choose a reason for hiding this comment

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

fine to have fallback.

I think this one can be removed add added to the "Input should be an object" message.

@samuelcolvin samuelcolvin enabled auto-merge (squash) May 26, 2023 12:20
@codecov-commenter
Copy link

Codecov Report

Merging #637 (edc373f) into main (6220455) will decrease coverage by 0.26%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #637      +/-   ##
==========================================
- Coverage   94.10%   93.85%   -0.26%     
==========================================
  Files          99       99              
  Lines       13561    13640      +79     
  Branches       25       25              
==========================================
+ Hits        12762    12802      +40     
- Misses        793      832      +39     
  Partials        6        6              
Impacted Files Coverage Δ
src/errors/types.rs 83.84% <100.00%> (-0.49%) ⬇️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6220455...edc373f. Read the comment docs.

@samuelcolvin samuelcolvin merged commit 8dab0c1 into main May 26, 2023
@samuelcolvin samuelcolvin deleted the feat/add-error-messages-json branch May 26, 2023 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

finish custom JSON errors
4 participants
0