Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2149
Optional[T]
Note that the JSON schema rep was unchanged here, so it might be beneficial to rewrite the type inference stuff to target the JSON schema directly in future (i.e., parsing the various
anyOf
bits when dealing with union types/optional fields).EDIT: I'm going to merge this once the tests pass, but not sure if you'd want to give a cursory look at e814cd26305f8cd7e1f604e5b2462e1dc1328d55 @CasperWA -- essentially, switching all the model annotations to
T | None
-style caused the match with your customUnionType
to fail. I fiddled around a bit with the other types you defined, but seems like the constructs like the officialtypes.UnionType
don't exist in those cases.