-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Is there someway of doing something like this?
raku -MJSON::Class -e '
class TestObject does JSON::Class {
has Str $.string;
}
constant TestObjects = (Array[TestObject] but JSON::Class);
class Bla does JSON::Class {
has TestObjects %.aaa;
}
my $json = q<{"aaa": [{ "string" : "one" }, { "string" : "two" }]}>;
say Bla.from-json: $json
'
Type check failed in assignment to %!aaa; expected Array[TestObject]+{JSON::Class} but got Array ([TestObject.new(stri...)
in sub _unmarshal at /Users/fernando/.rakubrew/versions/moar-2020.11/share/perl6/site/sources/BD58585C8BB103CC821AB89EFD8D30DA4FB8FDF9 (JSON::Unmarshal) line 112
in sub unmarshal at /Users/fernando/.rakubrew/versions/moar-2020.11/share/perl6/site/sources/BD58585C8BB103CC821AB89EFD8D30DA4FB8FDF9 (JSON::Unmarshal) line 158
in method from-json at /Users/fernando/.rakubrew/versions/moar-2020.11/share/perl6/site/sources/C0029D661A8CA443DB83A67FE58F3E10D590C1A0 (JSON::Class) line 91
in block <unit> at -e line 19
Metadata
Metadata
Assignees
Labels
No labels