{"id":19622151,"url":"https://github.com/commercetools/rmf-codegen","last_synced_at":"2026-02-24T12:16:59.683Z","repository":{"id":37100865,"uuid":"136635215","full_name":"commercetools/rmf-codegen","owner":"commercetools","description":"Provides RAML code generators based on RMF.","archived":false,"fork":false,"pushed_at":"2025-04-03T11:45:08.000Z","size":28950,"stargazers_count":13,"open_issues_count":26,"forks_count":6,"subscribers_count":29,"default_branch":"main","last_synced_at":"2025-04-20T15:17:59.360Z","etag":null,"topics":["audit-sdk","code","generation","kotlin","raml","rmf"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commercetools.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":"2018-06-08T15:17:50.000Z","updated_at":"2025-04-03T11:45:12.000Z","dependencies_parsed_at":"2024-02-13T12:46:14.321Z","dependency_job_id":"057a3270-2c05-4572-8939-23863ff1416e","html_url":"https://github.com/commercetools/rmf-codegen","commit_stats":{"total_commits":1620,"total_committers":21,"mean_commits":77.14285714285714,"dds":0.7191358024691358,"last_synced_commit":"d8b11464eccc994551a9a964fbc98126f4329ae5"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Frmf-codegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Frmf-codegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Frmf-codegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Frmf-codegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commercetools","download_url":"https://codeload.github.com/commercetools/rmf-codegen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251246376,"owners_count":21558762,"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":["audit-sdk","code","generation","kotlin","raml","rmf"],"created_at":"2024-11-11T11:26:13.776Z","updated_at":"2026-02-24T12:16:54.646Z","avatar_url":"https://github.com/commercetools.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RMF-Codegen\n\nRAML API client code generators based on the [RMF (REST Modeling Framework)](https://github.com/vrapio/rest-modeling-framework).\nThe code generators are written in [kotlin](https://kotlinlang.org/).\n\n## Supported output targets\n\n- `JAVA_CLIENT`:\n  - Java types for JSON serialization/deserialization of RAML types via [Jackson](https://github.com/FasterXML/jackson)\n  - Java client for accessing RAML resources via [Spring RestTemplate](https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html#webmvc-resttemplate)\n- `TYPESCRIPT_CLIENT`:\n  - TypeScript types generated from RAML types\n  - TypeScript types for validating JSON payloads via [hapijs/joi](https://github.com/hapijs/joi)\n- `CSHARP_CLIENT`\n- `PHP_CLIENT`\n- `POSTMAN`: Collection file for the [Postman API Client](https://www.postman.com/product/api-client/)\n- `RAML_DOC`: Emits RAML files targeted at generating robust and stable API documentation. Fully flattens and resolves types and resources. The output RAML has a fixed canonical filesystem structure and every type or resource file contains all information to fully document it. It's used by the [commercetools-docs-kit](https://github.com/commercetools/commercetools-docs-kit/tree/master/packages/gatsby-theme-api-docs)\n\n## Install `rmf-codegen` CLI\n\nTo install the rmf-codegen cli, run the following command\n\n```\ncurl -o- -s https://raw.githubusercontent.com/commercetools/rmf-codegen/main/scripts/install.sh | bash\n```\n\nYou will find a new command available `rmf-codegen`, you can check that all is good by executing `rmf-codegen -v`\n\n## NPM wrapper package\n\nThe [`commercetools-docs-kit`](https://github.com/commercetools/commercetools-docs-kit) provides an NPM package that automates the download of the JAR and provides the `rmf-codegen` command to JavaScript projects without global installation. (find at [NPM](https://www.npmjs.com/login?next=/package/@commercetools-docs/rmf-codegen))\n\n## Docker\n\nDocker images for the code generator are available in the Github Container Registry\n\n```\ndocker pull docker.pkg.github.com/commercetools/rmf-codegen/codegen:latest\n```\n## Usage\n\nGeneral Usage:\n\n```\nUsage: rmf-codegen [-hv] [COMMAND]\nAllows to validate RAML files and generate code from them\n  -h, --help                display this help message\n  -v, --version             print version information and exit\nCommands:\n  generate                  Generate source code from a RAML specification.\n  verify                    Allows to verify if a raml spec is valid.\n  validate                  Validate the raml spec against defined rules and generate a validation report.\n\n```\n\nGenerating Client SDKs or normalized RAML for documentation:\n\n```\nUsage: rmf-codegen generate [-hvw] [-b=\u003cbasePackageName\u003e]\n                            [-c=\u003cclientPackageName\u003e] [-m=\u003cmodelPackageName\u003e]\n                            -o=\u003coutputFolder\u003e [-s=\u003csharedPackage\u003e] -t=\u003ctarget\u003e\n                            \u003cramlFileLocation\u003e\nGenerate source code from a RAML specification.\n  \u003cramlFileLocation\u003e        Api file location\n  -b, --base-package=\u003cbasePackageName\u003e\n                            The base package, this package in case the model or\n                            client models aren't provided\n  -c, --client-package=\u003cclientPackageName\u003e\n                            The client package, This will be used as the package\n                            for the client stub.\n  -h, --help                display this help message\n  -m, --model-package=\u003cmodelPackageName\u003e\n                            The models package, this will be used as the model\n                            package in the generated code.\n  -o, --output-folder=\u003coutputFolder\u003e\n                            Output folder for generated files.\n  -s, --shared-package=\u003csharedPackage\u003e\n                            The shared package to be used for the generated code.\n  -t, --target=\u003ctarget\u003e     Specifies the code generation target\n                            Valid values: JAVA_CLIENT, TYPESCRIPT_CLIENT,\n                            CSHARP_CLIENT, PHP_CLIENT, PHP_BASE, PHP_TEST,\n                            POSTMAN, RAML_DOC\n  -v, --verbose             If set, this would move the verbosity level to debug.\n  -w, --watch               Watches the files for changes\n\n```\n\nVerifying a RAML API:\n\n```\nUsage: rmf-codegen verify [-hw] \u003cramlFileLocation\u003e\nAllows to verify if a RAML spec is valid.\n  \u003cramlFileLocation\u003e        Api file location\n  -h, --help                display this help message\n  -w, --watch               Watches the files for changes\n```\n\nValidating a RAML API and generating a validity report:\n\n```\nUsage: \u003cmain class\u003e validate [-hvw] [--list-rules] [-f=\u003coutputFormat\u003e]\n[-l=\u003clinkBase\u003e] [-lf=\u003clinkFormat\u003e]\n[-o=\u003coutputTarget\u003e] [-r=\u003crulesetFile\u003e]\n[-s=\u003ccheckSeverity\u003e] [-t=\u003ctempFile\u003e]\n\u003cramlFileLocation\u003e\n\nAllows to verify if a raml spec is valid according to CT guidelines and generates a validation report\n\n  \u003cramlFileLocation\u003e   Api file location\n  -f, --format=\u003coutputFormat\u003e Specifies the output format. Valid values: CLI, JSON, MARKDOWN\n  -h, --help               display this help message\n  -l, --link-base=\u003clinkBase\u003e\n  -lf, --link-format=\u003clinkFormat\u003e Specifies the link format. Valid values: CLI, GITHUB\n  --list-rules         Show all rules\n  -o, --outputTarget=\u003coutputTarget\u003e\n  -r, --ruleset=\u003crulesetFile\u003e Ruleset configuration\n  -s, --severity=\u003ccheckSeverity\u003e Diagnostic severity. Valid values: info, warn, error\n  -t, --temp=\u003ctempFile\u003e    Temporary folder\n  -v, --verbose            Verbose\n  -w, --watch              Watches the files for changes\n```\n\n## Development\n\n### Build the \"fat jar\"\n\nA single \"fat jar\" is built with the following commands:\n\n```sh\ncd tools/cli-application/\n../../gradlew build\n```\n\nThe JAR can then be found at `./rmf-codegen.jar`\n\n### Build a native executable with GraalVM\n\nA native executable is built with the following commands:\n\n```sh\ncd tools/cli-application/\n../../gradlew nativeImage\n```\n\nThe native executable can then be found at `./tools/cli-application/build/graal/rmf-codegen`.\nIt's currently only tested with Mac OS X. It emits error messages but the functionality works.\n\n### Why did we choose kotlin for writing our code generators?\n\nWe choose kotlin because of the following features:\n\n- extension methods, which allow us to add methods to our RMF model types\n- multi-line template string with embedded expressions, which allows us to keep the templates and the code in the same file\n- it integrates very well with our RMF Java types\n- it has very good IDE support, which makes writing code generators very easy\n\nThese features help in developing code generators for different programming languges/frameworks.\n\n# Running tests against your own RAML files\n\nOur `TestCodeGenerator` test can be run against a user provided RAML file by setting\nthe `TEST_RAML_FILE` environment variable to the file path.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Frmf-codegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommercetools%2Frmf-codegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Frmf-codegen/lists"}