Support generic types in the extension API dump #64469
Closed
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.
Summary
Currently we're using
{"type: "typedarray::Node"}
to represent a typed array.This PR changes this to:
{"type": "Array", "generic_type_args": [{"type": "Node"}]}
.Changing the value of
type
breaks compatiblity.Details
This is an alternative PR to #64249 suggested by @Bromeon in #64249 (comment)
Adds optional
array_type
field to specify the type of the array element whentype
isArray
(for example inNode::get_children
).The JSON for
Node::get_children
with this PR is now:If the
generic_type_args
is not present the type does not support or does not have generic type arguments, otherwise it contains an array with a dictionary object for each generic type argument. The dictionary object has atype
field with the type name for the generic type argument and can optionally also include ageneric_type_args
field if the type is generic as well.Currently only Arrays are supported so the
generic_type_args
will never be present for Arrays of Variants and will always have one generic type argument when the element type is specified. If Dictionaries support key/value types in the future they should have two generic type arguments and the order is important, if we only want to specify one argument (key or type) the other could have "Variant" in thetype
field or be an empty dictionary object.Alternative design