summaryrefslogtreecommitdiff
path: root/utils/spore2dot.pl
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-11-17 11:51:18 +0100
committerfranck cuny <franck@lumberjaph.net>2010-11-17 11:51:18 +0100
commite03f48683b982f8b9efd4ca0dae0bd6bca7411b5 (patch)
tree552b892fb679ccd18f929e8a901b7f375c7a1ad5 /utils/spore2dot.pl
parentadd format (diff)
parentspore2dot: split note & doc (diff)
downloadapi-description-e03f48683b982f8b9efd4ca0dae0bd6bca7411b5.tar.gz
Merge branch 'master' of github.com:SPORE/api-description
* 'master' of github.com:SPORE/api-description: spore2dot: split note & doc add modularized CouchDB spore2dot: add note Ohloh: typo add the Ohloh API, http://www.ohloh.net CouchDB: an alternate description (still incomplete) spore2dot: add a detailed generation Github: rename some methods s/^get_/list_/; Github/network: missing params
Diffstat (limited to 'utils/spore2dot.pl')
-rw-r--r--utils/spore2dot.pl42
1 files changed, 41 insertions, 1 deletions
diff --git a/utils/spore2dot.pl b/utils/spore2dot.pl
index 034e8c7..f7e0e7e 100644
--- a/utils/spore2dot.pl
+++ b/utils/spore2dot.pl
@@ -65,12 +65,52 @@ foreach my $spec (@specs) {
print $_, "\\]";
$first = 0;
}
+ if ($desc->{optional_payload}) {
+ print "\\[";
+ print ", " unless $first;
+ print "payload\\]";
+ $first = 0;
+ }
+ if ($desc->{unattended_params} || $spec->{unattended_params}) {
+ print ", " unless $first;
+ print "...";
+ }
print ")";
print " &otimes;" if $desc->{authentication} || $spec->{authentication};
+ print " DEPRECATED" if $desc->{deprecated};
print "\\l";
- print "&nbsp;&nbsp;&nbsp;", $desc->{method}, " ", $desc->{path}, "\\l" if $ENV{SPORE_PATH};
+ if ($ENV{SPORE_DETAILS}) {
+ print "&nbsp;&nbsp;&nbsp;", $desc->{method}, " ", $desc->{path}, "\\l";
+ for my $h (sort keys %{$desc->{headers}}) {
+ print "&nbsp;&nbsp;&nbsp;", $h, ": ", $desc->{headers}->{$h}, "\\l";
+ }
+ for my $f (sort keys %{$desc->{'form-data'}}) {
+ print "&nbsp;&nbsp;&nbsp;form-data \\\"", $f, "\\\" ", $desc->{'form-data'}->{$f}, "\\l";
+ }
+ my $status = $desc->{expected_status} || $spec->{expected_status};
+ print "&nbsp;&nbsp;&nbsp;", join(', ', @{$status}), "\\l" if $status;
+ }
}
print "}\"];\n\n";
+
+ my $note = $spec->{description};
+ if ($note && $ENV{SPORE_NOTES}) {
+ $note =~ s/\n/\\n/g;
+ print " \"__note__", $name, "\"\n";
+ print " [label=\"", $note, "\" shape=note];\n\n";
+
+ print " \"", $name, "\" -> \"__note__", $name, "\"\n";
+ print " [arrowhead = none, arrowtail = none, style = dashed];\n\n";
+ }
+ my $doc = $spec->{meta}->{documentation};
+ if ($doc && $ENV{SPORE_NOTES}) {
+ $doc =~ s/\n/\\n/g;
+ print " \"__doc__", $name, "\"\n";
+ print " [label=\"", $doc, "\" shape=note];\n\n";
+
+ print " \"", $name, "\" -> \"__doc__", $name, "\"\n";
+ print " [arrowhead = none, arrowtail = none, style = dashed];\n\n";
+ }
}
print "}\n";