-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
document request and response format
- Loading branch information
Showing
1 changed file
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,97 @@ | ||
# Gropius Layot DEV UI | ||
# Gropius Layout DEV UI | ||
|
||
More coming soon | ||
## Request Format | ||
|
||
```ts | ||
type RequestBody = Graph; | ||
|
||
interface Graph { | ||
components: ComponentVersion[]; | ||
relations: Relation[]; | ||
} | ||
|
||
interface ComponentVersion extends Node { | ||
name: string; | ||
style: ShapeStyle; | ||
interfaces: Interface[]; | ||
} | ||
|
||
interface Interface extends Node { | ||
name: string; | ||
style: ShapeStyle; | ||
}; | ||
|
||
interface Relation extends Node { | ||
name: string; | ||
start: string; | ||
end: string; | ||
style: RelationStyle; | ||
} | ||
|
||
interface Node { | ||
id: string; | ||
} | ||
|
||
interface StrokeStyle { | ||
stroke?: { | ||
color?: string; | ||
dash?: number[]; | ||
}; | ||
} | ||
|
||
interface FillStyle { | ||
fill?: { | ||
color: string; | ||
}; | ||
} | ||
|
||
interface ShapeStyle extends StrokeStyle, FillStyle { | ||
shape: Shape; | ||
radius?: number; | ||
} | ||
|
||
interface RelationStyle extends StrokeStyle { | ||
marker: Marker; | ||
} | ||
|
||
type Shape = "RECT" | "CIRCLE" | "ELLIPSE" | "RHOMBUS" | "HEXAGON"; | ||
|
||
type Marker = | ||
| "ARROW" | ||
| "DIAMOND" | ||
| "FILLED_DIAMOND" | ||
| "TRIANGLE" | ||
| "FILLED_TRIANGLE" | ||
| "CIRCLE" | ||
| "FILLED_CIRCLE"; | ||
``` | ||
|
||
::: info | ||
Note: this may be extended in the future to contain the size of components / interfaces. | ||
Further, the actual response body contains some additional fields which can be safely ignored. | ||
::: | ||
|
||
|
||
|
||
## Expected Response Format | ||
|
||
```ts | ||
type ResponseBody = GraphLayout; | ||
|
||
interface GraphLayout { | ||
[id: string]: ElementLayout | RelationLayout; | ||
} | ||
|
||
interface ElementLayout { | ||
pos: Point; | ||
} | ||
|
||
interface RelationLayout { | ||
points: Point[]; | ||
} | ||
|
||
interface Point { | ||
x: number; | ||
y: number; | ||
} | ||
``` |