From a98899003a801da0eac0b574417fc98fda54f547 Mon Sep 17 00:00:00 2001 From: Ed J Date: Sat, 22 Dec 2018 02:34:48 +0000 Subject: [PATCH] add x-id-field to operation/path specs --- lib/Mojolicious/Plugin/Yancy.pm | 1 + lib/Yancy/Help/Config.pod | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Mojolicious/Plugin/Yancy.pm b/lib/Mojolicious/Plugin/Yancy.pm index 5cbe6f76..da74eccc 100644 --- a/lib/Mojolicious/Plugin/Yancy.pm +++ b/lib/Mojolicious/Plugin/Yancy.pm @@ -585,6 +585,7 @@ sub _openapi_spec_infer_mojo { @{ $op_spec->{parameters} || [] }, ; my ($id_field) = grep defined, + (map $_->{'x-id-field'}, $op_spec, $pathspec), (@path_params && $path_params[-1]{name}); my %base_spec = ( controller => $api_controller, diff --git a/lib/Yancy/Help/Config.pod b/lib/Yancy/Help/Config.pod index dce5e8d6..7c915cf7 100644 --- a/lib/Yancy/Help/Config.pod +++ b/lib/Yancy/Help/Config.pod @@ -461,9 +461,13 @@ an error. To derive which collection, these things are considered: Each operation infers from the HTTP method plus other information which method of L it should connect to. -The C parameter is the C of the last C parameter -specified in the operation's spec. Every operation type except C -in "list" mode, and C, needs an C parameter. + +The C stash parameter is either the value of the C +key in the operation or path spec, or if not given, the C of the +last C parameter specified in the operation's spec. Every +operation type except C in "list" mode, and C, needs an +C parameter. This is what the controller will pass as the C +to the relevant L method. =head1 Additional Configuration