-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cope with and generate JMAP wrappers #30
Conversation
also, as_triple/s is now totally a thing
da7ce41
to
0a6ba69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
for my $call (@$calls) { | ||
my $request = _ARRAY0($input_request) | ||
? { methodCalls => $input_request } | ||
: { %$input_request }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use $input_request
here?
(update: I guess you want to keep the original around to inspect later. Never mind, then!)
t/basic.t
Outdated
[ | ||
jstr('atePies'), | ||
{ howMany => jnum(100), tastiestPieId => jstr(123) }, | ||
jstr('a'), | ||
], | ||
"as_struct", | ||
"as_triple", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or as_${triple_method}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few nits, looks good though
lib/JMAP/Tester.pm
Outdated
@@ -205,7 +209,7 @@ L<JMAP::Tester::Response> objects. | |||
=cut | |||
|
|||
sub request { | |||
my ($self, $calls) = @_; | |||
my ($self, $input_request, $arg) = @_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$arg
is unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I meant to add a means to request/demand wrapping or not. I'll just drop it until then.
$request->{methodCalls} = \@suffixed; | ||
|
||
$request = $request->{methodCalls} | ||
if $ENV{JMAP_TESTER_NO_WRAPPER} && _ARRAY0($input_request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the _ARRAY0($input_request)
here.
I suppose what we're saying is JMAP_TESTER_NO_WRAPPER
means "Do not wrap old-style calls" but it does not mean "Unwrap new style calls".
Okay.
|
||
C<as_struct> returns an arrayref containing the result of calling C<as_struct> | ||
on each sentence in the paragraph. C<as_stripped_struct> removes JSON types. | ||
C<as_triples> returns an arrayref containing the result of calling C<as_triples> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calls C<as_triple>
on each sentence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right!
8adb762
to
c133b61
Compare
also, as_triple/s is now totally a thing