INPUT }
if ($output) {
  my $members      = $EMPTY;
  my $output_shape = $shapes->{$output};
  my %shape_members = %{ $output_shape->{members} // {} };
  foreach my $m ( sort keys %shape_members ) {
    $members .= sprintf "\n=item %s\n", $m;
    $members .= html2pod $shape_members{$m}->{documentation};
  }
  $output = <<"OUTPUT";
OUTPUT }
my @error_items;
if ( @{$errors} ) {
  foreach my $e ( @{$errors} ) {
    my $shape = $shapes->{$e};
    push @error_items, '=over 5';
    push @error_items, sprintf "=item %s\n%s", $e, html2pod $shape->{documentation};
    if ( $shape->{error} ) {
      push @error_items, '=over 5';
      foreach my $k ( sort keys %{ $shape->{error} } ) {
        push @error_items, sprintf "=item %s\n\n%s", $k, $shape->{error}->{$k};
      }
      push @error_items, "=back\n";
    }
    push @error_items, "=back\n";
  }
  local $LIST_SEPARATOR = "\n\n";
  my $error_str = "@error_items";
  $errors = <<"ERRORS";
$error_str
ERRORS } else { $errors = $EMPTY; }
my $none = "=over 5\n\n=item NONE\n\n=back\n\n";
$output = $output || $none;
$errors = $errors || $none;
$input  = $input  || $none;
my $method_pod = <<'END_OF_POD';
@method@
@documentation@
- INPUT
 - 
@input@
 - OUTPUT
 - 
@output@
 - ERRORS
 - 
@errors@
 
END_OF_POD
my $http = $methods{$method}->{http};
my $http_method = $EMPTY;
my $request_uri = $EMPTY;
if ($http) {
  $http_method = $http->{method}     // $EMPTY;
  $request_uri = $http->{requestUri} // $EMPTY;
  my ( $request_uri_tpl, $args ) = parse_request_uri($request_uri);
  $operations->{$method}->{http}->{parsed_request_uri}
    = { request_uri_tpl => $request_uri_tpl, parameters => $args };
  $method_pod .= <<'END_OF_POD';
END_OF_POD
my @see_also;
push @see_also, $methods{$method}->{input}  || ();
push @see_also, $methods{$method}->{output} || ();
push @see_also, map { $_->{shape} } @{ $operations->{$method}->{errors} };
$parameters->{ to_template_var('see_also') } = join "\n",
  map { sprintf 'L<%s::%s>', $parameters->{ to_template_var('package_name') }, $_ } @see_also;
$parameters->{ to_template_var('method') }      = $method;
$parameters->{ to_template_var('errors') }      = $errors;
$parameters->{ to_template_var('input') }       = $input;
$parameters->{ to_template_var('output') }      = $output;
$parameters->{ to_template_var('http_method') } = $http_method;
$parameters->{ to_template_var('request_uri') } = $request_uri;
$parameters->{ to_template_var('documentation') } = $documentation;
my $package_name = $parameters->{ to_template_var('package_name') };
$package_name =~ s/::/\//gxsm;
push @pod, render_template $method_pod, $parameters;
my $pod_stub = <<'END_OF_POD';
=pod
NAME
@method@
SYNOPSIS
my $service = @package_name@->new;
my $rsp = $service->@method@($parameters);
DESCRIPTION
@documentation@
PARAMETERS
INPUT
@input@
OUTPUT
@output@
ERRORS
@errors@
NOTES
Method: @http_method@
Request URI: @request_uri@
SEE ALSO
@see_also@
AUTHOR
Autogenerate by @program_name@ on @timestamp@
LICENSE AND COPYRIGHT
This module is free software it may be used, redistributed and/or modified under the same terms as Perl itself.
NAME
@service@
DESCRIPTION
@documentation@
AVAILABLE COMMANDS
@available_commands@
NAME
@package_name@
DESCRIPTION
@description@
VERSION
Version @program_version@
METHODS AND SUBROUTINES
@methods@
NOTES
Autogenerated by @program_name@ at @timestamp@
LICENSE AND COPYRIGHT
This module is free software it may be used, redistributed and/or modified under the same terms as Perl itself.