enhance readme

This commit is contained in:
2026-01-07 10:08:41 +11:00
parent ea04b9a299
commit c832d65fae

View File

@@ -8,8 +8,47 @@ This code references translation data provided by diagrams.net, previously draw.
There is a version of this code hosted at https://g2d.coadcorp.com
## CLI
`go build -o gliffy2drawio ./cmd/gliffy2drawio/main.go`
Build the CLI:
```bash
go build -o gliffy2drawio ./cmd/gliffy2drawio
```
### Command line arguments
- -in Input file path
- -out Output file path
### 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")"'" }'
```