Allow field overrides via Annotated#604
Conversation
3ddc9a8 to
7c98e50
Compare
| fields_with_specific_annotation = ( | ||
| ( | ||
| field_name, | ||
| next((a for a in annotations if isinstance(a, annotation_type_)), None), |
There was a problem hiding this comment.
This function will only find annotations that were instantiated, which works fine for the purpose of finding annotations created by gen.override()
|
A pretty good start! Here's how I would proceed, but let me know if you run into difficulties and we need to rethink. Let's introduce a new module, Then we can use this helper method to extract instances of This helper method should also be used in |
161e5a7 to
c8df676
Compare
|
Hello! I liked this idea so I wrote an independent implementation to get it over the line: #717 Thank you for trying to work on it ;) |
Here's a simple implementation of using
Annotatedto provide field overrides. Please let me know where's the best place for this code or feel free to move it somewhere else.Tests could also be improved (I just moved them from another project).
Refs: