[ARVADOS] updated: 259d69ccefce787f5d2a4f2828ac4b0135432c87
git at public.curoverse.com
git at public.curoverse.com
Tue Dec 31 16:54:48 EST 2013
Summary of changes:
doc/gen_api_schema_docs.py | 77 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
create mode 100755 doc/gen_api_schema_docs.py
via 259d69ccefce787f5d2a4f2828ac4b0135432c87 (commit)
from d8c504bddb3c5940fc6955ae7107f06736f85022 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 259d69ccefce787f5d2a4f2828ac4b0135432c87
Author: Tim Pierce <twp at curoverse.com>
Date: Tue Dec 31 16:54:17 2013 -0500
Added `gen_api_schema_docs.py' used to generate schema documentation pages.
diff --git a/doc/gen_api_schema_docs.py b/doc/gen_api_schema_docs.py
new file mode 100755
index 0000000..632a67f
--- /dev/null
+++ b/doc/gen_api_schema_docs.py
@@ -0,0 +1,77 @@
+#! /usr/bin/env python
+
+# gen_api_schema_docs.py
+#
+# Generate Textile documentation pages for Arvados schema resources.
+
+import requests
+import re
+import os
+
+r = requests.get('https://localhost:9900/arvados/v1/schema',
+ verify=False)
+if r.status_code != 200:
+ raise Exception('Bad status code %d: %s' % (r.status_code, r.text))
+
+if 'application/json' not in r.headers.get('content-type', ''):
+ raise Exception('Unexpected content type: %s: %s' %
+ (r.headers.get('content-type', ''), r.text))
+
+schema = r.json()
+navorder = 0
+for resource in sorted(schema.keys()):
+ navorder = navorder + 1
+ properties = schema[resource]
+ res_api_endpoint = re.sub(r'([a-z])([A-Z])', r'\1_\2', resource).lower()
+ outfile = "{}.textile".format(resource)
+ if os.path.exists(outfile):
+ outfile = "{}_new.textile".format(resource)
+ print outfile, "..."
+ with open(outfile, "w") as f:
+ f.write("""---
+layout: default
+navsection: api
+navmenu: Schema
+title: {resource}
+navorder: {navorder}
+---
+
+h1. {resource}
+
+A **{resource}** represents...
+
+h2. Methods
+
+See "REST methods for working with Arvados resources":/api/methods.html
+
+API endpoint base: @https://{{{{ site.arvados_api_host }}}}/arvados/v1/{res_api_endpoint}@
+
+h2. Creation
+
+h3. Prerequisites
+
+Prerequisites for creating a {resource}.
+
+h3. Side effects
+
+Side effects of creating a {resource}.
+
+h2. Resources
+
+Each {resource} has, in addition to the usual "attributes of Arvados resources":resources.html:
+
+table(table table-bordered table-condensed).
+|_. Attribute|_. Type|_. Description|_. Example|
+""".format(
+ resource=resource,
+ navorder=navorder,
+ res_api_endpoint=res_api_endpoint))
+
+ for prop in properties:
+ if prop not in ['id', 'uuid', 'href', 'kind', 'etag', 'self_link',
+ 'owner_uuid', 'created_at',
+ 'modified_by_client_uuid',
+ 'modified_by_user_uuid',
+ 'modified_at']:
+ f.write('|{name}|{type}|||\n'.format(**prop))
+
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list