55 lines
1.2 KiB
Markdown
55 lines
1.2 KiB
Markdown
## About
|
|
AI generated code, both command line and simple REST API. Converts a supplied gliffy diagram to draw.io format.
|
|
|
|
## License
|
|
This code references translation data provided by diagrams.net, previously draw.io, which is licensed under the Apache 2.0 license.
|
|
|
|
## Running
|
|
There is a version of this code hosted at https://g2d.coadcorp.com
|
|
|
|
## CLI
|
|
Build the CLI:
|
|
```bash
|
|
go build -o gliffy2drawio ./cmd/gliffy2drawio
|
|
```
|
|
|
|
### Command line usage
|
|
```bash
|
|
gliffy2drawio -in input.gliffy -out output.drawio
|
|
```
|
|
|
|
#### Flags
|
|
- `-in` (required) Path to the Gliffy JSON or .gliffy file.
|
|
- `-out` (optional) Path to write the draw.io XML. If omitted, XML is written to stdout.
|
|
|
|
## REST API
|
|
The HTTP server exposes a simple REST endpoint plus docs.
|
|
|
|
- Swagger UI: `http://localhost:8080/swagger`
|
|
- OpenAPI spec: `http://localhost:8080/openapi.json`
|
|
|
|
### Endpoint
|
|
`POST /api/convert`
|
|
|
|
**Request body**
|
|
```json
|
|
{
|
|
"data": "<gliffy JSON string>"
|
|
}
|
|
```
|
|
|
|
**Response**
|
|
```json
|
|
{
|
|
"xml": "<draw.io XML string>",
|
|
"warning": "optional warning text"
|
|
}
|
|
```
|
|
|
|
**Example**
|
|
```bash
|
|
curl -X POST http://localhost:8080/api/convert \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"data": "'"$(cat sample-input.gliffy | tr -d "\n")"'" }'
|
|
```
|