Skip to content

Conversation

sydney-runkle
Copy link
Contributor

@sydney-runkle sydney-runkle commented Sep 30, 2024

Progress on pydantic/pydantic#10299

Sort of reminds me of #619, maybe we want to change this implementation to reflect some of those constraints?

Copy link

codspeed-hq bot commented Sep 30, 2024

CodSpeed Performance Report

Merging #1469 will not alter performance

Comparing invalid-schema (95626d6) with main (e3eff5c)

Summary

✅ 155 untouched benchmarks

Copy link
Contributor

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

What's the current error message if you try to create a SchemaValidator containing one of these? Should it be improved?

@sydney-runkle
Copy link
Contributor Author

What's the current error message if you try to create a SchemaValidator containing one of these? Should it be improved?

Good question. Definitely could be improved, though seems maybe ok for now?

Traceback (most recent call last):
  File "/Users/programming/pydantic_work/pydantic-core/test.py", line 3, in <module>
    sv = SchemaValidator(core_schema.invalid_schema())
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.SchemaError: Unknown schema type: "invalid"

@sydney-runkle
Copy link
Contributor Author

@davidhewitt, I can easily edit the error message in mod.rs. What would you prefer?

@davidhewitt
Copy link
Contributor

That placeholder seems reasonable. How about adding a BuildValidator implementation that's guaranteed to error (with something like "invalid schemas can never be instantiated")?

@sydney-runkle sydney-runkle enabled auto-merge (squash) October 7, 2024 15:29
@sydney-runkle sydney-runkle merged commit 0af18c4 into main Oct 7, 2024
27 of 28 checks passed
@sydney-runkle sydney-runkle deleted the invalid-schema branch October 7, 2024 15:30
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