+sub generate_typetext {
+ my ($schema) = @_;
+ my $typetext = '';
+ my (@optional, @required);
+ foreach my $key (sort keys %$schema) {
+ next if !$schema->{$key}->{format_description};
+ if ($schema->{$key}->{optional}) {
+ push @optional, $key;
+ } else {
+ push @required, $key;
+ }
+ }
+ my ($pre, $post) = ('', '');
+ foreach my $key (@required) {
+ my $desc = $schema->{$key}->{format_description};
+ $typetext .= "$pre$key=<$desc>$post";
+ $pre = ', ';
+ }
+ $pre = ' [,' if $pre;
+ foreach my $key (@optional) {
+ my $desc = $schema->{$key}->{format_description};
+ $typetext .= "$pre$key=<$desc>$post";
+ $pre = ' [,';
+ $post = ']';
+ }
+ return $typetext;
+}
+