https://github.com/samuelmarks/cdd-ruby
OpenAPI ↔ Ruby
https://github.com/samuelmarks/cdd-ruby
Last synced: about 1 month ago
JSON representation
OpenAPI ↔ Ruby
- Host: GitHub
- URL: https://github.com/samuelmarks/cdd-ruby
- Owner: SamuelMarks
- License: apache-2.0
- Created: 2026-03-01T08:06:24.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2026-05-22T07:18:18.000Z (about 2 months ago)
- Last Synced: 2026-05-22T15:26:34.600Z (about 2 months ago)
- Language: Ruby
- Homepage:
- Size: 227 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
cdd-ruby
========
[](https://opensource.org/licenses/Apache-2.0)
[](https://offscale.io/wasm_web_demo)
[](https://github.com/SamuelMarks/cdd-ruby/actions)
[](#)
[](#)
----
OpenAPI ↔ Ruby. This is one compiler in a suite, all focussed on the same task: Compiler Driven Development (CDD).
Each compiler is written in its target language, is whitespace and comment sensitive, and has both an SDK and CLI.
The core philosophy of Compiler Driven Development (CDD) is synchronization without compromise. Where traditional generators silo your API boundaries into read-only files, this compiler natively merges changes into your codebase via a robust, [whitespace and comment aware] Abstract Syntax Tree (AST) driven parser & emitter. It bridges the gap between design and implementation, allowing you to seamlessly generate SDKs from a spec or extract a spec from existing code. By keeping your APIs, SDKs, and tests in continuous, automated alignment, it drastically improves both delivery speed and software reliability.
The CLI—at a minimum—has:
- `cdd-ruby --help`
- `cdd-ruby --version`
- `cdd-ruby from_openapi to_sdk_cli -i spec.json`
- `cdd-ruby from_openapi to_sdk -i spec.json`
- `cdd-ruby from_openapi to_server -i spec.json`
- `cdd-ruby to_openapi -i `
- `cdd-ruby to_docs_json --no-imports --no-wrapping -i spec.json`
- `cdd-ruby serve_json_rpc -p 8080 -l 127.0.0.1`
## SDK Example
```rb
require 'cdd'
config = Cdd::Config.new(input_path: 'spec.json', output_dir: 'src/models')
Cdd.generate_sdk(config)
puts "SDK generation complete."
```
## Installation
```bash
bundle install
```
## Development
You can use standard tooling commands or the included cross-platform Makefiles to fetch dependencies, build, and test:
```bash
bundle install
rspec
# or
make deps
make build
make test
# or on Windows
.\make.bat deps
.\make.bat build
.\make.bat test
```
See [PUBLISH.md](PUBLISH.md) for packaging and releasing.
## Features
The `cdd-ruby` compiler leverages a unified architecture to support various facets of API and code lifecycle management. For a deep dive into the compiler's design, see [ARCHITECTURE.md](ARCHITECTURE.md).
- **Compilation**:
- **OpenAPI → `Ruby`**: Generate idiomatic native models, network routes, client SDKs, and boilerplate directly from OpenAPI (`.json` / `.yaml`) specifications.
- **`Ruby` → OpenAPI**: Statically parse existing `Ruby` source code and emit compliant OpenAPI specifications.
- **AST-Driven & Safe**: Employs static analysis instead of unsafe dynamic execution or reflection, allowing it to safely parse and emit code even for incomplete or un-compilable project states.
- **Seamless Sync**: Keep your docs, tests, database, clients, and routing in perfect harmony. Update your code, and generate the docs; or update the docs, and generate the code.
**Uncommon Features:**
`cdd-ruby` supports standard CDD features.
## CLI Options
```text
Usage: cdd-ruby [command] [options]
Commands:
to_openapi -i [-o ]
to_docs_json -i [-o ] [--no-imports] [--no-wrapping]
from_openapi to_sdk_cli -i | --input-dir [-o ] [--no-github-actions] [--no-installable-package] [--tests]
from_openapi to_sdk -i | --input-dir [-o ] [--no-github-actions] [--no-installable-package] [--tests]
from_openapi to_server -i | --input-dir [-o ] [--no-github-actions] [--no-installable-package] [--tests]
serve_json_rpc [-p|--port ] [-l|--listen
]
--help
--version
```
---
## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or )
- MIT license ([LICENSE-MIT](LICENSE-MIT) or )
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.