@unispechq/unispec-schema 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -111,6 +111,41 @@ The canonical, machine-readable definition of UniSpec lives in the schema/ direc
|
|
|
111
111
|
- All examples must validate against the schema
|
|
112
112
|
- Breaking changes require explicit agreement and a major version bump
|
|
113
113
|
|
|
114
|
+
## Service Object
|
|
115
|
+
|
|
116
|
+
The UniSpec document describes a single `service`.
|
|
117
|
+
|
|
118
|
+
### `service` fields
|
|
119
|
+
|
|
120
|
+
- **`name`** (required) — service identifier.
|
|
121
|
+
- **`description`** (optional) — human-readable description.
|
|
122
|
+
- **`version`** (optional) — service contract version (SemVer).
|
|
123
|
+
- **`protocols`** (optional) — protocol-specific API surfaces (`rest`, `graphql`, `websocket`).
|
|
124
|
+
- **`schemas`** (optional) — reusable schemas referenced by protocol definitions.
|
|
125
|
+
|
|
126
|
+
### `schemaRef` convention
|
|
127
|
+
|
|
128
|
+
Fields named `schemaRef` reference schemas defined in `service.schemas`.
|
|
129
|
+
|
|
130
|
+
Recommended format:
|
|
131
|
+
|
|
132
|
+
- `<SchemaName>` where `SchemaName` is a key in `service.schemas`.
|
|
133
|
+
|
|
134
|
+
Tools may also accept a JSON Pointer form:
|
|
135
|
+
|
|
136
|
+
- `#/service/schemas/<SchemaName>`
|
|
137
|
+
|
|
138
|
+
### Protocol URLs
|
|
139
|
+
|
|
140
|
+
GraphQL and WebSocket protocol definitions may include an optional `url` field.
|
|
141
|
+
|
|
142
|
+
Recommended: relative path (e.g. `/graphql`, `/ws`). Absolute URLs are allowed only if the service is tightly bound to a single host.
|
|
143
|
+
|
|
144
|
+
If omitted, tooling may assume common framework defaults:
|
|
145
|
+
|
|
146
|
+
- GraphQL: `/graphql`
|
|
147
|
+
- WebSocket: `/ws` (or `/socket.io` for Socket.IO)
|
|
148
|
+
|
|
114
149
|
## Examples
|
|
115
150
|
|
|
116
151
|
The examples/ directory contains official UniSpec examples:
|
package/package.json
CHANGED
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"properties": {
|
|
31
|
+
"url": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Optional path or URL of the GraphQL endpoint. Recommended: relative path (e.g. '/graphql'). Absolute URLs are allowed only if the service is tightly bound to a single host. If omitted, tooling may assume a framework default (commonly '/graphql')."
|
|
34
|
+
},
|
|
31
35
|
"schema": {
|
|
32
36
|
"type": "string",
|
|
33
37
|
"description": "GraphQL schema SDL as a string. Canonical source of type definitions."
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
},
|
|
94
94
|
"schemaRef": {
|
|
95
95
|
"type": "string",
|
|
96
|
-
"description": "Reference to a reusable schema defined in the service
|
|
96
|
+
"description": "Reference to a reusable schema defined in service.schemas. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
"additionalProperties": false
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"properties": {
|
|
104
104
|
"schemaRef": {
|
|
105
105
|
"type": "string",
|
|
106
|
-
"description": "Reference to a reusable schema used as the content payload."
|
|
106
|
+
"description": "Reference to a reusable schema defined in service.schemas used as the content payload. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
109
|
"additionalProperties": false
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"schemaRef": {
|
|
18
18
|
"type": "string",
|
|
19
|
-
"description": "Reference to a reusable schema describing the message payload."
|
|
19
|
+
"description": "Reference to a reusable schema describing the message payload. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"additionalProperties": false
|
|
@@ -68,6 +68,10 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"properties": {
|
|
71
|
+
"url": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "Optional path or URL of the WebSocket endpoint. Recommended: relative path (e.g. '/ws' or '/socket.io' for Socket.IO). Absolute URLs are allowed only if the service is tightly bound to a single host. If omitted, tooling may assume a framework default (commonly '/ws' for WebSocket servers or '/socket.io' for Socket.IO)."
|
|
74
|
+
},
|
|
71
75
|
"channels": {
|
|
72
76
|
"type": "array",
|
|
73
77
|
"description": "WebSocket channels/topics exposed by the service.",
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
},
|
|
206
206
|
"schemaRef": {
|
|
207
207
|
"type": "string",
|
|
208
|
-
"description": "Reference to a schema from service.schemas for schemaOnly mode."
|
|
208
|
+
"description": "Reference to a schema from service.schemas for schemaOnly mode. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
211
|
"additionalProperties": false
|