Closes #31 Support oneOf that contains primitive types and objects #32
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.
@davidmigloz this is a little tricky, how does one discern between the following hypothetical example where there are no union keys between objects:
Im not a fan of this hypothetical API definition, but it still allowed by the OpenAPI spec.
ChatCompletionFunctionCallOption
and the otherobject
cannot be differentiated fromMap<String,dynamic>
for deserialization logic... just one use case that came to mind. The solution in this PR accounts for that should it arise by having a smart sort order and try/catch when attempting to deserialize a known object union. Best solution I could conjure without making things more difficult than necessary.Result
For your use case referenced in #31 this would be the result. I am not really sure of a better way to shorten the constructor for
ChatCompletionFunctionCall.chatCompletionFunctionCallOption
and ensure it is unique. Open to suggestions.If this is good enough for you, we can merge it in. Will wait for confirmation or any follow-up suggestions.