enable MISSING and NoDefault sentinel#1656
Conversation
|
hi @Ksauder - would you be able to add some matix to test with |
|
Sure I can look into that. I'm still working out actually using this in practice. I'm debugging some issues when a schema with MISSING is actually used as a return schema from an operation. |
7e41aea to
af717db
Compare
|
@vitalik Okay, I think this is a pretty clean implementation. Added two args to create_schema and relevant child functions |
@vitalik Actually, I'm not sure how you would like this implemented. I'm not familiar with the github CICD, and I assume you want it there. How exactly would you like this done? |
1cbc36f to
bc73f2c
Compare
bc73f2c to
f0b3fe3
Compare
310ca57 to
35f3522
Compare
|
@vitalik Hi, I just rebased, cleaned up, and got the test matrix done. Any interest in this or anything I can do to move it forward? |
#1655
I've been struggling with model schemas having
nullas an option for fields that I simply want to omit from the response. If the keys don't exist in the response, then there is no data. The current implementation does not allow changing howcreate_schemahandles nullable fields and it always assigns atype | None = None. This causes all of my generated api clients to type hint incorrectly which is really annoying.exclude_unsetalso does not work for modelschemas since it's technically set since the model instance is interrogated via attributes and returns an explicitNonefor nullable fields and it does not help generate an accurate json schema.The main feature of this PR is allowing modification to the type and value used when a field is "nullable". This allows
MISSINGto be used, which will create the data schema I'm looking for, while also supporting other type/value combos.