{"id":13582158,"url":"https://github.com/grofers/go-codon","last_synced_at":"2025-09-03T23:31:59.729Z","repository":{"id":23191852,"uuid":"88632612","full_name":"grofers/go-codon","owner":"grofers","description":"Workflow based REST framework code generator","archived":false,"fork":false,"pushed_at":"2023-09-01T09:47:31.000Z","size":176,"stargazers_count":142,"open_issues_count":4,"forks_count":8,"subscribers_count":97,"default_branch":"master","last_synced_at":"2024-12-22T10:34:51.811Z","etag":null,"topics":["aggregation","concurrency","golang","mistral","rest","rest-api","swagger","web","web-framework","workflow","workflows"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/grofers.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}},"created_at":"2017-04-18T14:09:43.000Z","updated_at":"2023-08-16T09:54:46.000Z","dependencies_parsed_at":"2022-08-23T18:20:11.900Z","dependency_job_id":"b6412a21-f8b3-4989-bca4-47132b45f3fc","html_url":"https://github.com/grofers/go-codon","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grofers%2Fgo-codon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grofers%2Fgo-codon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grofers%2Fgo-codon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grofers%2Fgo-codon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grofers","download_url":"https://codeload.github.com/grofers/go-codon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231926367,"owners_count":18447052,"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":["aggregation","concurrency","golang","mistral","rest","rest-api","swagger","web","web-framework","workflow","workflows"],"created_at":"2024-08-01T15:02:27.736Z","updated_at":"2024-12-30T23:56:05.198Z","avatar_url":"https://github.com/grofers.png","language":"Go","readme":"# go-codon\nGenerates Go server code from a combination of REST and Workflow DSLs.\n\n[![Build Status](https://travis-ci.org/grofers/go-codon.svg?branch=master)](https://travis-ci.org/grofers/go-codon)\n\nA codon service has three components:\n- `Server`: Accepts and validates HTTP requests\n- `Clients`: Clients for upstream services which this service consumes\n- `Workflows`: Procedures for every REST endpoint of this server which consume Clients and other custom actions.\n\nServer and Client side specifications are written in Swagger. Swagger code generation is done through go-swagger. Workflow is written in `Flow`, a Mistral inspired workflow specification in YAML. Its specification can be found [here](https://github.com/grofers/go-codon/wiki/Workflow-DSL-Specification).\n\nCheck out [wiki](https://github.com/grofers/go-codon/wiki) section for more information. Follow [this tutorial](https://github.com/grofers/go-codon/wiki/Codon:-REST-Workflow-Framework) for a very basic example on how to use this tool.\n\n## Installation\nSet up your Golang development environment ([Getting Started](https://golang.org/doc/install)). Set your `GOPATH` and `GOBIN` directories. Also add `GOBIN` to your `PATH` so that golang tools can be used in command line.\n\nDownload the latest binary from Github releases and put it in your `GOBIN` directory. Or to install from source do:\n```sh\nmkdir -p $GOPATH/src/github.com/grofers\ncd $GOPATH/src/github.com/grofers\ngit clone git@github.com:grofers/go-codon.git\ncd go-codon\nmake install\n```\n\n## Example\nThis is what a workflow looks like (for an API to get posts and the comments for each post concurrently):\n```yaml\nname: get_posts_comments\nstart:\n    - get_posts\ntasks:\n    get_posts:\n        action: clients.jplaceholder.get_posts\n        input:\n            userId: \u003c%jmes main.userId %\u003e\n        publish:\n            posts: \u003c%jmes action %\u003e\n        on-success:\n            - get_all_comments: true\n    get_comments:\n        action: clients.jplaceholder.get_comments\n        input:\n            postId: \u003c%jmes main.postId %\u003e\n        publish:\n            comments: \u003c%jmes action %\u003e\n    get_all_comments:\n        with-items: \u003c%jmes main.posts %\u003e\n        loop:\n            task: get_comments\n            input:\n                postId: \u003c%jmes item.id %\u003e\n            publish:\n                combined: \u003c%jmes {\"post_details\":item,\"comments\":task.comments} %\u003e\noutput:\n    body: \u003c%jmes main.combined %\u003e\n    status_code: 200\n```\nTo run this example checkout [examples](https://github.com/grofers/codon-examples).\n\n## Projects go-codon would not exist without\n(Or just projects I am really thankful for)\n- [go-swagger](https://github.com/go-swagger/go-swagger): Provides code generators for client and server side components using [Swagger](https://swagger.io/) specification.\n- [go-jmespath](https://github.com/jmespath/go-jmespath): Allows for easy querying and manipulation of json objects in workflows.\n- [Pongo2](https://github.com/flosch/pongo2): Django template renderer. Used for templates and workflow expressions in codon.\n- [Mistral DSL](https://docs.openstack.org/mistral/latest/): A workflow spec used for infrastructure orchestration. Codon's workflow DSL is inspired from Mistral's but modified for use in REST context.\n- [mapstructure](https://github.com/mitchellh/mapstructure)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrofers%2Fgo-codon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrofers%2Fgo-codon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrofers%2Fgo-codon/lists"}