enhance readme
This commit is contained in:
47
README.md
47
README.md
@@ -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
|
There is a version of this code hosted at https://g2d.coadcorp.com
|
||||||
|
|
||||||
## CLI
|
## CLI
|
||||||
`go build -o gliffy2drawio ./cmd/gliffy2drawio/main.go`
|
Build the CLI:
|
||||||
|
```bash
|
||||||
|
go build -o gliffy2drawio ./cmd/gliffy2drawio
|
||||||
|
```
|
||||||
|
|
||||||
### Command line arguments
|
### Command line usage
|
||||||
- -in Input file path
|
```bash
|
||||||
- -out Output file path
|
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")"'" }'
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user