{"id":15476642,"url":"https://github.com/mooreniemi/choclety","last_synced_at":"2025-10-26T08:16:09.636Z","repository":{"id":69572268,"uuid":"80456450","full_name":"mooreniemi/choclety","owner":"mooreniemi","description":"a hypermedia api spec grapher","archived":false,"fork":false,"pushed_at":"2017-02-11T20:34:36.000Z","size":580,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T00:27:57.158Z","etag":null,"topics":["cytoscape","graph","hypermedia","web"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mooreniemi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-30T19:44:28.000Z","updated_at":"2017-02-08T16:16:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"27961a15-dda9-4495-badc-ae43b180098a","html_url":"https://github.com/mooreniemi/choclety","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooreniemi%2Fchoclety","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooreniemi%2Fchoclety/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooreniemi%2Fchoclety/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mooreniemi%2Fchoclety/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mooreniemi","download_url":"https://codeload.github.com/mooreniemi/choclety/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239435390,"owners_count":19638122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cytoscape","graph","hypermedia","web"],"created_at":"2024-10-02T03:40:37.021Z","updated_at":"2025-10-26T08:16:04.598Z","avatar_url":"https://github.com/mooreniemi.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![choclety?](/choclety.png)\n\n# choclety\na hypermedia api-spec grapher, based on [this blog post](http://mooreniemi.github.io/apis/web/rest/2017/01/04/when-is-an-api-better-or-worse.html)\n\n## purpose\n\nInput: an api spec file.\n\nOutput: a useful graph of your api, and maybe your api itself.\n\nHere's a screenshot of the example output, with shortest path to your revenue generating node highlighted:\n\n![](/choclety.gif)\n\nAnd [here's a hosted version](https://mooreniemi.github.io/choclety/) you can click around on.\n\n## usage\n\n### graph output\n\nTo generate a [cytoscape graph](http://js.cytoscape.org/), run `./choc g \u003capi-spec\u003e.json`, ie.:\n\n```\n./choc g ApiSpecs/api-spec.json\n./choc g ApiSpecs/api-spec-2.json\n./choc g ApiSpecs/api-spec-3.json\n```\n\nThen run a server in the root directory to view, ie.:\n\n```\npython -m SimpleHTTPServer 8000\n```\n\n### api output\n\nTo generate an api, run `./choc a \u003capi-spec\u003e.json`, ie.:\n\n```\n./choc a ApiSpecs/api-spec.json\n```\n\nCurrently we're just generating a [single file Sinatra app](http://www.sinatrarb.com/contrib/json.html), so you can run it using `ruby YourAppName.rb`.\n\n## the spec format\n\nIs not formalized. But essentially forces you to write your API spec as a graph in the form of an edge list and a node list. `choc` is building adjency lists for you automatically. Technically we could get everything we need from edges, but then they start to get a ton of properties.\n\nThe spec format at the top level requires:\n\n```json\n{\n  \"state_transitions\": [],\n  \"state_representations\": []\n}\n```\n\nFor generating a graph, `StateTransition`s require:\n\n```json\n{\n  \"source\": \"from node\",\n  \"target\": \"to node\",\n  \"link_relation\": \"edge label\",\n  \"verb\": \"protocol specific modifier for your remote call, ie. POST in http\"\n}\n```\n\nFor generating an api, `StateTransition`s require one of the 3 or they will have urls generated by convention:\n\n```json\n{\n  \"url_template\": \"function signature of your remote call\",\n  \"url_template_type\": \"named templates, ie. collection_item\",\n  \"url\": \"static direct url\"\n}\n```\n\nFor generating a graph or api, `StateRepresentation`s require:\n\n\n```json\n{\n  \"name\": \"name of representation, must be unique. namespace with . if necessary, ie. namespace.name\",\n  \"noun\": \"special values for our graph describing their representation type, understood values: generated_revenue|error|null\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmooreniemi%2Fchoclety","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmooreniemi%2Fchoclety","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmooreniemi%2Fchoclety/lists"}