about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrancois Perrad <francois.perrad@gadz.org>2010-10-28 20:00:16 +0200
committerFrancois Perrad <francois.perrad@gadz.org>2010-10-28 20:00:16 +0200
commit5ee435e295ab8d09571e9c670e3cdaf7fc28c789 (patch)
treeec8d8c6e166571d83a17bd3b5c68287543dd383d
parentspore2dot: add a detailed generation (diff)
downloadapi-description-5ee435e295ab8d09571e9c670e3cdaf7fc28c789.tar.gz
CouchDB: an alternate description
(still incomplete)
-rw-r--r--apps/couchdb/Makefile29
-rw-r--r--apps/couchdb/couchdb.pngbin0 -> 261335 bytes
-rw-r--r--apps/couchdb/database.json147
-rw-r--r--apps/couchdb/design.json142
-rw-r--r--apps/couchdb/document.json155
-rw-r--r--apps/couchdb/server.json86
6 files changed, 559 insertions, 0 deletions
diff --git a/apps/couchdb/Makefile b/apps/couchdb/Makefile
new file mode 100644
index 0000000..a8177ca
--- /dev/null
+++ b/apps/couchdb/Makefile
@@ -0,0 +1,29 @@
+
+VALIDATOR := perl ../../utils/validator.pl --schema spore_validation.rx --description
+SPORE2DOT := perl ../../utils/spore2dot.pl
+
+check: spore_validation.rx
+	@$(VALIDATOR) server.json
+	@$(VALIDATOR) database.json
+	@$(VALIDATOR) document.json
+	@$(VALIDATOR) design.json
+
+test: check
+
+spore_validation.rx:
+	wget http://github.com/SPORE/specifications/raw/master/spore_validation.rx
+
+png: couchdb.png
+
+%.png : %.dot
+	dot -T png -o $@ $<
+
+couchdb.dot: \
+    server.json \
+    database.json \
+    document.json \
+    design.json
+	$(SPORE2DOT) $^ > $@
+
+clean:
+	-rm *.png *.dot spore_validation.rx
diff --git a/apps/couchdb/couchdb.png b/apps/couchdb/couchdb.png
new file mode 100644
index 0000000..41379cf
--- /dev/null
+++ b/apps/couchdb/couchdb.png
Binary files differdiff --git a/apps/couchdb/database.json b/apps/couchdb/database.json
new file mode 100644
index 0000000..080b148
--- /dev/null
+++ b/apps/couchdb/database.json
@@ -0,0 +1,147 @@
+{
+   "version" : "0.1",
+   "methods" : {
+      "get_info" : {
+         "path" : "/:db",
+         "method" : "GET",
+         "required_params" : [
+            "db"
+         ]
+      },
+      "create_db" : {
+         "path" : "/:db",
+         "method" : "PUT",
+         "required_params" : [
+            "db"
+         ],
+         "expected_status" : [ 201, 412 ]
+      },
+      "delete_db" : {
+         "path" : "/:db",
+         "method" : "DELETE",
+         "required_params" : [
+            "db"
+         ],
+         "expected_status" : [ 200, 404 ]
+      },
+      "get_changes" : {
+         "path" : "/:db/_changes",
+         "method" : "GET",
+         "required_params" : [
+            "db"
+         ],
+         "optional_params" : [
+            "feed",
+            "filter",
+            "heartbeat",
+            "since",
+            "style"
+         ],
+         "unattended_params" : true
+      },
+      "compact" : {
+         "path" : "/:db/_compact",
+         "method" : "POST",
+         "required_params" : [
+            "db"
+         ],
+         "expected_status" : [ 202 ]
+      },
+      "compact_design" : {
+         "path" : "/:db/_compact/design-doc",
+         "method" : "POST",
+         "required_params" : [
+            "db"
+         ],
+         "expected_status" : [ 202 ]
+      },
+      "clean_view" : {
+         "path" : "/:db/_view_cleanup",
+         "method" : "POST",
+         "required_params" : [
+            "db"
+         ]
+      },
+      "execute_view" : {
+         "path" : "/:db/_temp_view",
+         "method" : "POST",
+         "required_params" : [
+            "db"
+         ]
+      },
+      "ensure_full_commit" : {
+         "path" : "/:db/_ensure_full_commit",
+         "method" : "POST",
+         "required_params" : [
+            "db"
+         ]
+      },
+      "bulk_docs" : {
+         "path" : "/:db/_bulk_docs",
+         "method" : "POST",
+         "required_params" : [
+            "db"
+         ]
+      },
+      "purge" : {
+         "path" : "/:db/_purge",
+         "method" : "POST",
+         "required_params" : [
+            "db"
+         ]
+      },
+      "get_all_docs" : {
+         "path" : "/:db/_all_docs",
+         "method" : "GET",
+         "required_params" : [
+            "db"
+         ],
+         "optional_params" : [
+            "descending",
+            "startkey",
+            "endkey",
+            "limit"
+         ]
+      },
+      "get_security" : {
+         "path" : "/:db/_security",
+         "method" : "GET",
+         "required_params" : [
+            "db"
+         ]
+      },
+      "set_security" : {
+         "path" : "/:db/_security",
+         "method" : "PUT",
+         "required_params" : [
+            "db"
+         ],
+         "required_payload" : true
+      },
+      "get_revs_limit" : {
+         "path" : "/:db/_revs_limit",
+         "method" : "GET",
+         "required_params" : [
+            "db"
+         ]
+      },
+      "set_revs_limit" : {
+         "path" : "/:db/_revs_limit",
+         "method" : "PUT",
+         "required_params" : [
+            "db"
+         ],
+         "required_payload" : true
+      }
+   },
+   "formats" : [
+      "json"
+   ],
+   "expected_status" : [ 200 ],
+   "name" : "CouchDB",
+   "authority" : "http://github.com/SPORE",
+   "meta" : {
+      "documentation" : "http://wiki.apache.org/couchdb/Complete_HTTP_API_Reference",
+      "module" : "database"
+   }
+}
diff --git a/apps/couchdb/design.json b/apps/couchdb/design.json
new file mode 100644
index 0000000..0b1cc51
--- /dev/null
+++ b/apps/couchdb/design.json
@@ -0,0 +1,142 @@
+{
+   "version" : "0.1",
+   "methods" : {
+      "get_design" : {
+         "path" : "/:db/_design/:design",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "design"
+         ],
+         "optional_params" : [
+            "rev",
+            "revs"
+         ]
+      },
+      "add_design" : {
+         "path" : "/:db/_design/:design",
+         "method" : "PUT",
+         "required_params" : [
+            "db",
+            "design"
+         ],
+         "required_payload" : true,
+         "expected_status" : [ 201, 409 ]
+      },
+      "delete_design" : {
+         "path" : "/:db/_design/:design",
+         "method" : "DELETE",
+         "required_params" : [
+            "db",
+            "design",
+            "rev"
+         ]
+      },
+      "copy_design" : {
+         "path" : "/:db/_design/:design",
+         "method" : "COPY",
+         "headers" : {
+            "Destination" : ":dest"
+         },
+         "required_params" : [
+            "db",
+            "design",
+            "dest"
+         ],
+         "optional_params" : [
+            "rev"
+         ],
+         "expected_status" : [ 201 ]
+      },
+      "get_design_attachment" : {
+         "path" : "/:db/_design/:design/:file",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "design",
+            "file"
+         ]
+      },
+      "add_design_attachment" : {
+         "path" : "/:db/_design/:design/:file",
+         "method" : "PUT",
+         "required_params" : [
+            "db",
+            "design",
+            "file"
+         ],
+         "required_payload" : true,
+         "expected_status" : [ 201, 409 ]
+      },
+      "delete_design_attachment" : {
+         "path" : "/:db/_design/:design/:file",
+         "method" : "DELETE",
+         "required_params" : [
+            "db",
+            "design",
+            "file"
+         ],
+         "expected_status" : [ 200, 409 ]
+      },
+      "get_design_info" : {
+         "path" : "/:db/_design/:design/_info",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "design"
+         ]
+      },
+      "get_view" : {
+         "path" : "/:db/_design/:design/_view/:view",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "design",
+            "view"
+         ]
+      },
+      "get_show_without_doc" : {
+         "path" : "/:db/_design/:design/_show/:show",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "design",
+            "show"
+         ],
+         "unattended_params" : true
+      },
+      "get_show" : {
+         "path" : "/:db/_design/:design/_show/:show/:id",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "design",
+            "show",
+            "id"
+         ],
+         "unattended_params" : true
+      },
+      "get_list" : {
+         "path" : "/:db/_design/:design/_list/:list/:view",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "design",
+            "list",
+            "view"
+         ],
+         "unattended_params" : true
+      }
+   },
+   "expected_status" : [ 200, 404 ],
+   "formats" : [
+      "json"
+   ],
+   "name" : "CouchDB",
+   "authority" : "http://github.com/SPORE",
+   "meta" : {
+      "documentation" : "http://wiki.apache.org/couchdb/Complete_HTTP_API_Reference",
+      "module" : "design",
+      "enable_if" : "get_design_attachment"
+   }
+}
diff --git a/apps/couchdb/document.json b/apps/couchdb/document.json
new file mode 100644
index 0000000..12e5afb
--- /dev/null
+++ b/apps/couchdb/document.json
@@ -0,0 +1,155 @@
+{
+   "version" : "0.1",
+   "methods" : {
+      "insert_document" : {
+         "path" : "/:db",
+         "method" : "POST",
+         "required_params" : [
+            "db"
+         ],
+         "required_payload" : true,
+         "expected_status" : [ 201, 409 ]
+      },
+      "get_document" : {
+         "path" : "/:db/:id",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "id"
+         ],
+         "optional_params" : [
+            "rev",
+            "revs"
+         ]
+      },
+      "add_document" : {
+         "path" : "/:db/:id",
+         "method" : "PUT",
+         "required_params" : [
+            "db",
+            "id"
+         ],
+         "required_payload" : true,
+         "expected_status" : [ 201, 409 ]
+      },
+      "delete_document" : {
+         "path" : "/:db/:id",
+         "method" : "DELETE",
+         "required_params" : [
+            "db",
+            "id",
+            "rev"
+         ],
+         "expected_status" : [ 200, 409 ]
+      },
+      "copy_document" : {
+         "path" : "/:db/:id",
+         "method" : "COPY",
+         "headers" : {
+            "Destination" : ":dest"
+         },
+         "required_params" : [
+            "db",
+            "id",
+            "dest"
+         ],
+         "optional_params" : [
+            "rev"
+         ],
+         "expected_status" : [ 201 ]
+      },
+      "get_attachment" : {
+         "path" : "/:db/:id/:file",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "id",
+            "file"
+         ]
+      },
+      "add_attachment" : {
+         "path" : "/:db/:id/:file",
+         "method" : "PUT",
+         "headers" : {
+            "Content-Type" : ":content_type"
+         },
+         "required_params" : [
+            "db",
+            "id",
+            "rev",
+            "file",
+            "content_type"
+         ],
+         "required_payload" : true,
+         "expected_status" : [ 201, 409 ]
+      },
+      "delete_attachment" : {
+         "path" : "/:db/:id/:file",
+         "method" : "DELETE",
+         "required_params" : [
+            "db",
+            "id",
+            "file"
+         ]
+      },
+      "get_local_document" : {
+         "path" : "/:db/_local/:id",
+         "method" : "GET",
+         "required_params" : [
+            "db",
+            "id"
+         ],
+         "optional_params" : [
+            "rev",
+            "revs"
+         ]
+      },
+      "add_local_document" : {
+         "path" : "/:db/_local/:id",
+         "method" : "PUT",
+         "required_params" : [
+            "db",
+            "id"
+         ],
+         "required_payload" : true,
+         "expected_status" : [ 201, 409 ]
+      },
+      "delete_local_document" : {
+         "path" : "/:db/_local/:id",
+         "method" : "DELETE",
+         "required_params" : [
+            "db",
+            "id",
+            "rev"
+         ],
+         "expected_status" : [ 200, 409 ]
+      },
+      "copy_local_document" : {
+         "path" : "/:db/_local/:id",
+         "method" : "COPY",
+         "headers" : {
+            "Destination" : ":dest"
+         },
+         "required_params" : [
+            "db",
+            "id",
+            "dest"
+         ],
+         "optional_params" : [
+            "rev"
+         ],
+         "expected_status" : [ 201 ]
+      }
+   },
+   "formats" : [
+      "json"
+   ],
+   "expected_status" : [ 200, 404 ],
+   "name" : "CouchDB",
+   "authority" : "http://github.com/SPORE",
+   "meta" : {
+      "documentation" : "http://wiki.apache.org/couchdb/Complete_HTTP_API_Reference",
+      "module" : "document",
+      "enable_if" : "get_attachment"
+   }
+}
diff --git a/apps/couchdb/server.json b/apps/couchdb/server.json
new file mode 100644
index 0000000..3f59827
--- /dev/null
+++ b/apps/couchdb/server.json
@@ -0,0 +1,86 @@
+{
+   "version" : "0.1",
+   "methods" : {
+      "get_root" : {
+         "path" : "/",
+         "method" : "GET"
+      },
+      "get_all_dbs" : {
+         "path" : "/_all_dbs",
+         "method" : "GET"
+      },
+      "get_active_tasks" : {
+         "path" : "/_active_tasks",
+         "method" : "GET"
+      },
+      "replicate" : {
+         "path" : "/_replicate",
+         "method" : "POST",
+         "required_payload" : true
+      },
+      "get_uuids" : {
+         "path" : "/_uuids",
+         "method" : "GET",
+         "optional_params" : [
+            "count"
+         ]
+      },
+      "restart" : {
+         "path" : "/_restart",
+         "method" : "POST"
+      },
+      "get_stats" : {
+         "path" : "/_stats",
+         "method" : "GET"
+      },
+      "get_log" : {
+         "path" : "/_log",
+         "method" : "GET"
+      },
+      "get_config" : {
+         "path" : "/_config",
+         "method" : "GET"
+      },
+      "get_config_section" : {
+         "path" : "/_config/:section",
+         "method" : "GET",
+         "required_params" : [
+            "section"
+         ]
+      },
+      "get_config_item" : {
+         "path" : "/_config/:section/:key",
+         "method" : "GET",
+         "required_params" : [
+            "section",
+            "key"
+         ]
+      },
+      "set_config_item" : {
+         "path" : "/_config/:section/:key",
+         "method" : "PUT",
+         "required_params" : [
+            "section",
+            "key"
+         ]
+      },
+      "delete_config_item" : {
+         "path" : "/_config/:section/:key",
+         "method" : "DELETE",
+         "required_params" : [
+            "section",
+            "key"
+         ]
+      }
+   },
+   "formats" : [
+      "json"
+   ],
+   "expected_status" : [ 200 ],
+   "name" : "CouchDB",
+   "authority" : "http://github.com/SPORE",
+   "meta" : {
+      "documentation" : "http://wiki.apache.org/couchdb/Complete_HTTP_API_Reference",
+      "module" : "server"
+   }
+}