Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/userosettadev/rosetta-cli

Converting code into OpenAPI Specification
https://github.com/userosettadev/rosetta-cli

ai api devops openapi openapi-specification swagger

Last synced: 3 months ago
JSON representation

Converting code into OpenAPI Specification

Awesome Lists containing this project

README

        

[![CI](https://github.com/userosettadev/rosetta-cli/actions/workflows/go.yml/badge.svg)](https://github.com/userosettadev/rosetta-cli/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/userosettadev/rosetta-cli)](https://goreportcard.com/report/github.com/userosettadev/rosetta-cli)
[![codecov](https://codecov.io/gh/userosettadev/rosetta-cli/graph/badge.svg?token=XOWMEPON83)](https://codecov.io/gh/userosettadev/rosetta-cli)
[![Latest Git Tag](https://img.shields.io/github/tag/userosettadev/rosetta-cli.svg)](https://github.com/userosettadev/rosetta-cli/releases)

# Getting Started
Rosetta is a service that automatically generates an OpenAPI specification from code.

## Limitations
- **Supported Languages**: Currently, _Rosetta_ exclusively supports Go. However, we are actively working on expanding language support.
If you want to support another language, [please let us know](https://github.com/userosettadev/rosetta-cli/discussions/5).
- **Number of Runs**: The number of runs allowed is based on your account type.
- **Project Size**: The maximum project size is based on your account type.

## Installation

### Install with Go
```bash
go install github.com/userosettadev/rosetta-cli@latest
```

### macOS
Rosetta can be installed on macOS using [Homebrew](https://brew.sh/):
```bash
brew tap userosettadev/rosetta
brew install rosetta
```

### Windows
For Windows, you can download the Rosetta executable from the [releases page](TODO).

1. Visit the releases page and download the latest version of Rosetta for Windows.
2. Extract the downloaded archive.
3. Move the `rosetta.exe` file to a directory in your system's `PATH`.

## Verify Installation
After the installation is complete, you can verify it by running the following command (or executing the appropriate method for your installation):
```
rosetta --version
```

## Setup
Before using Rosetta, you need to set the `ROSETTA_API_KEY` environment variable:
```
export ROSETTA_API_KEY=
```
To get a key, [signup to Rosetta](https://www.userosetta.com/).

## Running Rosetta - Generating an OpenAPI Spec
To generate an OpenAPI specification from your code using Rosetta, you can use the `gen` command followed by the path to your code and the programming language.
```
rosetta gen /path/to/code -l
```

### Example
To generate an OpenAPI specification from Go code located in the `./myapp` directory, you would run:
```
rosetta gen ./myapp -l go
```
This command will analyze the Go code in the `./myapp` directory and generate an OpenAPI specification based on the code.

### Docker
Rosetta is also available as a Docker image:
```bash
docker run --rm -v $PWD:/app -w /app -e ROSETTA_API_KEY=$ROSETTA_API_KEY ghcr.io/userosettadev/rosetta-cli gen /path/to/code -l go