Skip to content

Conversation

samuelcolvin
Copy link
Member

fix #60

Turns out I needed this for #127.

ref on any schema type can now be used to make that validator available to be used elsewhere, this involves moving that validator into slots so will be slightly slower than not using ref.

@codecov
Copy link

codecov bot commented Jun 28, 2022

Codecov Report

Merging #130 (1870d3c) into main (0e32399) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #130      +/-   ##
==========================================
+ Coverage   97.30%   97.31%   +0.01%     
==========================================
  Files          40       40              
  Lines        3900     3916      +16     
  Branches       29       28       -1     
==========================================
+ Hits         3795     3811      +16     
  Misses        105      105              
Impacted Files Coverage Δ
pydantic_core/_types.py 100.00% <100.00%> (ø)
src/validators/mod.rs 98.98% <100.00%> (+0.05%) ⬆️
src/validators/recursive.rs 97.50% <100.00%> (-0.38%) ⬇️

Continue to review full report at Codecov.

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

@samuelcolvin samuelcolvin merged commit 1919da1 into main Jun 28, 2022
@samuelcolvin samuelcolvin deleted the simplify-recursive-references2 branch June 28, 2022 18:29
@adriangb
Copy link
Member

Would it be possible to not put it into slots or remove it (haven't dug into the Rust part lately) if it is not used as a recursive ref? That way the schema creators can basically always set ref and not worry about it.

@samuelcolvin
Copy link
Member Author

I guess it might be possible - would involve iterating through the rest of the schema to check.

This would have to be a pre-processing function (in whatever language). I think best to keep it in python when generating the schema, but that opinion might change :-).

@adriangb
Copy link
Member

sounds reasonable, at lest it's just performance so it can be optimized later in whatever language

@samuelcolvin
Copy link
Member Author

Would it be possible to not put it into slots or remove it (haven't dug into the Rust part lately) if it is not used as a recursive ref? That way the schema creators can basically always set ref and not worry about it.

This is done in #243 so we can always set ref guilt-free.

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.

simplify recursive refs
2 participants