@unispechq/unispec-schema 0.3.1 → 0.3.4

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
@@ -1,167 +1,196 @@
1
- # UniSpec Specification
2
-
3
- Official specification of the UniSpec API definition language
4
-
5
- ## Overview
6
-
7
- UniSpec is a modern, multi-protocol API specification format designed to unify REST, GraphQL, WebSocket, and event-driven API documentation under a single, consistent model.
8
-
9
- This repository is the single source of truth for the UniSpec format.
10
- It contains everything required to understand, validate, and evolve the language:
11
-
12
- - Machine-readable JSON Schemas
13
- - Human-readable reference documentation
14
- - Official examples (REST, GraphQL, WebSocket, mixed APIs)
15
- - Versioning and compatibility rules
16
- - Documented process for evolving the format over time
17
-
18
- UniSpec powers all components of the UniSpec platform:
19
- Core Engine CLI Framework Adapters → Registry → Portal → Enterprise extensions.
20
-
21
- ## Repository Structure
22
- ```pgsql
23
- unispec-spec/
24
- ├─ schema/ # JSON Schemas defining the UniSpec format
25
- ├─ unispec.schema.json
26
- └─ types/
27
- ├─ service.schema.json
28
- ├─ rest.schema.json
29
- │ ├─ graphql.schema.json
30
- │ ├─ websocket.schema.json
31
- │ ├─ schemas.schema.json
32
- └─ common.schema.json
33
-
34
- ├─ examples/ # Real-world examples in YAML/JSON
35
- ├─ simple-rest.yaml
36
- ├─ graphql.yaml
37
- │ ├─ websocket.yaml
38
- └─ mixed-api.yaml
39
-
40
- ├─ reference/ # Human-readable format documentation
41
- │ ├─ fields.md
42
- ├─ components.md
43
- ├─ versioning.md
44
- │ └─ style-guide.md
45
-
46
- ├─ CHANGELOG.md # Release notes for UniSpec format versions
47
- └─ README.md
48
- ```
49
-
50
- ## Purpose of This Repository
51
-
52
- This repo defines the UniSpec language, not its implementation.
53
-
54
- ### This repository contains:
55
-
56
- - Format specification
57
- - JSON Schemas
58
- - Examples and documentation
59
- - Rules for versioning and compatibility
60
- - Documented process for evolving the format over time
61
-
62
- ### This repository does NOT contain:
63
-
64
- - UniSpec Core engine
65
- - CLI implementation
66
- - Framework adapters
67
- - Portal or Registry code
68
- - Runtime logic
69
-
70
- These live in other repositories of the UniSpec organization.
71
-
72
- ## Format Philosophy
73
-
74
- UniSpec is built on the following principles:
75
-
76
- 1. Multi-protocol by design
77
- - One format supports:
78
- - REST
79
- - GraphQL
80
- - WebSocket
81
- - (future) gRPC, AsyncAPI, message buses
82
-
83
- 2. Developer-first
84
- - Readable YAML for humans, strict JSON Schema for machines.
85
-
86
- 3. Strong structure, minimal ambiguity
87
- - No vague fields or implicit semantics.
88
- - Every field has a precise definition and validation rules.
89
-
90
- 4. Extensible
91
- - Supports custom extensions via x-extensions, similar to OpenAPI but cleaner and more consistent.
92
-
93
- 5. Transparent evolution
94
- - All major changes must be clearly documented.
95
- - Minor changes and clarifications must maintain backward compatibility.
96
-
97
- ## JSON Schema
98
-
99
- The canonical, machine-readable definition of UniSpec lives in the schema/ directory.
100
-
101
- ### Rules:
102
-
103
- - Must follow JSON Schema Draft 2020-12
104
- - Must use $defs for reusable components
105
- - Must clearly describe field semantics and constraints
106
- - All examples must validate against the schema
107
- - Breaking changes require explicit agreement and a major version bump
108
-
109
- ## Examples
110
-
111
- The examples/ directory contains official UniSpec examples:
112
-
113
- - simple-rest.yaml — minimal REST service
114
- - graphql.yaml — example of a GraphQL API
115
- - websocket.yaml — WebSocket channels and messages
116
- - mixed-api.yaml service combining REST + GraphQL + WebSocket
117
-
118
- All examples are validated as part of CI to ensure correctness.
119
-
120
- ## Reference Documentation
121
-
122
- All human-readable format documentation lives in reference/:
123
-
124
- - fields.mddetailed field-by-field description
125
- - components.md — rules for schema composition and references
126
- - versioning.md — semantic versioning guidelines
127
- - style-guide.md — recommended naming and structuring conventions
128
-
129
- These documents must be kept in sync with schema changes.
130
-
131
- ## Versioning
132
-
133
- UniSpec follows Semantic Versioning (SemVer):
134
-
135
- - MAJOR — breaking changes
136
- - MINOR — new backward-compatible features
137
- - PATCH — fixes, clarifications, corrections
138
-
139
- All changes must be recorded in CHANGELOG.md.
140
-
141
- ## Format Changes and Contributions
142
-
143
- Any change that alters:
144
-
145
- - structure of the UniSpec format
146
- - semantics of existing fields
147
- - compatibility rules
148
- - supported protocols
149
-
150
- should be proposed and discussed in a pull request before being applied here.
151
-
152
- ## Contributing
153
-
154
- Contributions are welcome!
155
-
156
- To contribute:
157
-
158
- 1. Read the reference docs.
159
- 2. Discuss substantial format changes in an issue or pull request.
160
- 3. Submit a PR with clear explanation and schema validation.
161
-
162
- All contributions must preserve backward compatibility unless explicitly approved otherwise.
163
-
164
- ## License
165
-
166
- This repository is open-source and free to implement.
1
+ # UniSpec Specification
2
+
3
+ Official specification of the UniSpec API definition language
4
+
5
+ ## Overview
6
+
7
+ UniSpec is a modern, multi-protocol API specification format designed to unify REST, GraphQL, WebSocket, and event-driven API documentation under a single, consistent model.
8
+
9
+ This repository is the single source of truth for the UniSpec format.
10
+ It contains everything required to understand, validate, and evolve the language:
11
+
12
+ - Machine-readable JSON Schemas
13
+ - Human-readable reference documentation
14
+ - Official examples (REST, GraphQL, WebSocket, mixed APIs)
15
+ - A companion test specification (UniSpec Tests) for executable test documents
16
+ - Versioning and compatibility rules
17
+ - Documented process for evolving the format over time
18
+
19
+ UniSpec powers all components of the UniSpec platform:
20
+ Core Engine → CLI → Framework Adapters → Registry → Portal → Enterprise extensions.
21
+
22
+ ## Repository Structure
23
+ ```pgsql
24
+ unispec-spec/
25
+ ├─ schema/ # JSON Schemas defining the UniSpec format
26
+ ├─ unispec.schema.json # Core UniSpec document
27
+ ├─ unispec-tests.schema.json # UniSpec Tests document (executable test cases)
28
+ └─ types/
29
+ │ ├─ service.schema.json
30
+ │ ├─ rest.schema.json
31
+ │ ├─ graphql.schema.json
32
+ ├─ websocket.schema.json
33
+ ├─ schemas.schema.json
34
+ │ └─ common.schema.json
35
+
36
+ ├─ examples/ # Real-world examples in YAML/JSON
37
+ │ ├─ simple-rest.yaml
38
+ ├─ graphql.yaml
39
+ ├─ websocket.yaml
40
+ ├─ mixed-api.yaml
41
+ │ ├─ rest-with-schemas.yaml # REST service using service.schemas and schemaRef
42
+ └─ rest-with-schemas.tests.yaml # UniSpec Tests for the same REST service
43
+
44
+ ├─ reference/ # Human-readable format documentation
45
+ ├─ fields.md
46
+ ├─ components.md
47
+ │ ├─ versioning.md
48
+ │ ├─ style-guide.md
49
+ │ └─ tests.md # UniSpec Tests format reference
50
+
51
+ ├─ CHANGELOG.md # Release notes for UniSpec format versions
52
+ └─ README.md
53
+ ```
54
+
55
+ ## Purpose of This Repository
56
+
57
+ This repo defines the UniSpec language, not its implementation.
58
+
59
+ ### This repository contains:
60
+
61
+ - Format specification
62
+ - JSON Schemas
63
+ - Examples and documentation
64
+ - Rules for versioning and compatibility
65
+ - Documented process for evolving the format over time
66
+
67
+ ### This repository does NOT contain:
68
+
69
+ - UniSpec Core engine
70
+ - CLI implementation
71
+ - Framework adapters
72
+ - Portal or Registry code
73
+ - Runtime logic
74
+
75
+ These live in other repositories of the UniSpec organization.
76
+
77
+ ## Format Philosophy
78
+
79
+ UniSpec is built on the following principles:
80
+
81
+ 1. Multi-protocol by design
82
+ - One format supports:
83
+ - REST
84
+ - GraphQL
85
+ - WebSocket
86
+ - (future) gRPC, AsyncAPI, message buses
87
+
88
+ 2. Developer-first
89
+ - Readable YAML for humans, strict JSON Schema for machines.
90
+
91
+ 3. Strong structure, minimal ambiguity
92
+ - No vague fields or implicit semantics.
93
+ - Every field has a precise definition and validation rules.
94
+
95
+ 4. Extensible
96
+ - Supports custom extensions via x-extensions, similar to OpenAPI but cleaner and more consistent.
97
+
98
+ 5. Transparent evolution
99
+ - All major changes must be clearly documented.
100
+ - Minor changes and clarifications must maintain backward compatibility.
101
+
102
+ ## JSON Schema
103
+
104
+ The canonical, machine-readable definition of UniSpec lives in the schema/ directory.
105
+
106
+ ### Rules:
107
+
108
+ - Must follow JSON Schema Draft 2020-12
109
+ - Must use $defs for reusable components
110
+ - Must clearly describe field semantics and constraints
111
+ - All examples must validate against the schema
112
+ - Breaking changes require explicit agreement and a major version bump
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
+ ## Examples
139
+
140
+ The examples/ directory contains official UniSpec examples:
141
+
142
+ - simple-rest.yaml — minimal REST service
143
+ - graphql.yaml example of a GraphQL API
144
+ - websocket.yaml — WebSocket channels and messages
145
+ - mixed-api.yaml service combining REST + GraphQL + WebSocket
146
+
147
+ All examples are validated as part of CI to ensure correctness.
148
+
149
+ ## Reference Documentation
150
+
151
+ All human-readable format documentation lives in reference/:
152
+
153
+ - fields.md — detailed field-by-field description
154
+ - components.md — rules for schema composition and references
155
+ - versioning.md — semantic versioning guidelines
156
+ - style-guide.md — recommended naming and structuring conventions
157
+
158
+ These documents must be kept in sync with schema changes.
159
+
160
+ ## Versioning
161
+
162
+ UniSpec follows Semantic Versioning (SemVer):
163
+
164
+ - MAJOR — breaking changes
165
+ - MINOR — new backward-compatible features
166
+ - PATCH fixes, clarifications, corrections
167
+
168
+ All changes must be recorded in CHANGELOG.md.
169
+
170
+ ## Format Changes and Contributions
171
+
172
+ Any change that alters:
173
+
174
+ - structure of the UniSpec format
175
+ - semantics of existing fields
176
+ - compatibility rules
177
+ - supported protocols
178
+
179
+ should be proposed and discussed in a pull request before being applied here.
180
+
181
+ ## Contributing
182
+
183
+ Contributions are welcome!
184
+
185
+ To contribute:
186
+
187
+ 1. Read the reference docs.
188
+ 2. Discuss substantial format changes in an issue or pull request.
189
+ 3. Submit a PR with clear explanation and schema validation.
190
+
191
+ All contributions must preserve backward compatibility unless explicitly approved otherwise.
192
+
193
+ ## License
194
+
195
+ This repository is open-source and free to implement.
167
196
  The UniSpec format is designed to be an open standard.
package/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- const unispec = require("./schema/unispec.schema.json");
2
- const manifest = require("./schema/index.json");
3
-
4
- module.exports = {
5
- unispec,
6
- manifest,
7
- };
1
+ const unispec = require("./schema/unispec.schema.json");
2
+ const manifest = require("./schema/index.json");
3
+
4
+ module.exports = {
5
+ unispec,
6
+ manifest,
7
+ };
package/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export const unispec: Record<string, any>;
2
- export const manifest: Record<string, any>;
3
-
4
- declare const _default: {
5
- unispec: typeof unispec;
6
- manifest: typeof manifest;
7
- };
8
-
9
- export default _default;
1
+ export const unispec: Record<string, any>;
2
+ export const manifest: Record<string, any>;
3
+
4
+ declare const _default: {
5
+ unispec: typeof unispec;
6
+ manifest: typeof manifest;
7
+ };
8
+
9
+ export default _default;
package/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { createRequire } from "module";
2
-
3
- const require = createRequire(import.meta.url);
4
-
5
- const unispec = require("./schema/unispec.schema.json");
6
- const manifest = require("./schema/index.json");
7
-
8
- export { unispec, manifest };
9
- export default { unispec, manifest };
1
+ import { createRequire } from "module";
2
+
3
+ const require = createRequire(import.meta.url);
4
+
5
+ const unispec = require("./schema/unispec.schema.json");
6
+ const manifest = require("./schema/index.json");
7
+
8
+ export { unispec, manifest };
9
+ export default { unispec, manifest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unispechq/unispec-schema",
3
- "version": "0.3.1",
3
+ "version": "0.3.4",
4
4
  "description": "Official UniSpec JSON Schemas",
5
5
  "type": "module",
6
6
  "main": "index.cjs",
@@ -31,12 +31,19 @@
31
31
  "type": "git",
32
32
  "url": "git+https://github.com/unispec/unispec-spec.git"
33
33
  },
34
+ "bugs": {
35
+ "url": "https://github.com/unispec/unispec-spec/issues"
36
+ },
37
+ "homepage": "https://github.com/unispec/unispec-spec#readme",
34
38
  "keywords": [
35
39
  "unispec",
36
40
  "api",
37
41
  "json-schema",
38
42
  "specification"
39
43
  ],
44
+ "engines": {
45
+ "node": ">=18"
46
+ },
40
47
  "publishConfig": {
41
48
  "access": "public"
42
49
  }
package/schema/index.json CHANGED
@@ -1,14 +1,14 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "name": "@unispechq/unispec-schema",
4
- "description": "Official UniSpec JSON Schemas",
5
- "root": "./unispec.schema.json",
6
- "types": {
7
- "common": "./types/common.schema.json",
8
- "graphql": "./types/graphql.schema.json",
9
- "rest": "./types/rest.schema.json",
10
- "schemas": "./types/schemas.schema.json",
11
- "service": "./types/service.schema.json",
12
- "websocket": "./types/websocket.schema.json"
13
- }
14
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "name": "@unispechq/unispec-schema",
4
+ "description": "Official UniSpec JSON Schemas",
5
+ "root": "./unispec.schema.json",
6
+ "types": {
7
+ "common": "./types/common.schema.json",
8
+ "graphql": "./types/graphql.schema.json",
9
+ "rest": "./types/rest.schema.json",
10
+ "schemas": "./types/schemas.schema.json",
11
+ "service": "./types/service.schema.json",
12
+ "websocket": "./types/websocket.schema.json"
13
+ }
14
+ }
@@ -1,16 +1,16 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://unispec.dev/schema/types/common.schema.json",
4
- "title": "Common UniSpec definitions",
5
- "$defs": {
6
- "Identifier": {
7
- "type": "string",
8
- "description": "Identifier for services, operations, channels, etc.",
9
- "pattern": "^[A-Za-z_][A-Za-z0-9_.-]*$"
10
- },
11
- "Description": {
12
- "type": "string",
13
- "description": "Human-readable description text."
14
- }
15
- }
16
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unispec.dev/schema/types/common.schema.json",
4
+ "title": "Common UniSpec definitions",
5
+ "$defs": {
6
+ "Identifier": {
7
+ "type": "string",
8
+ "description": "Identifier for services, operations, channels, etc.",
9
+ "pattern": "^[A-Za-z_][A-Za-z0-9_.-]*$"
10
+ },
11
+ "Description": {
12
+ "type": "string",
13
+ "description": "Human-readable description text."
14
+ }
15
+ }
16
+ }
@@ -1,58 +1,58 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://unispec.dev/schema/types/graphql.schema.json",
4
- "title": "GraphQL API surface",
5
- "type": "object",
6
- "$defs": {
7
- "Operation": {
8
- "type": "object",
9
- "required": ["name"],
10
- "properties": {
11
- "name": {
12
- "$ref": "./common.schema.json#/$defs/Identifier"
13
- },
14
- "description": {
15
- "$ref": "./common.schema.json#/$defs/Description"
16
- },
17
- "deprecated": {
18
- "type": "boolean",
19
- "description": "Marks the operation as deprecated.",
20
- "default": false
21
- },
22
- "deprecationReason": {
23
- "type": "string",
24
- "description": "Human-readable reason for deprecation."
25
- }
26
- },
27
- "additionalProperties": false
28
- }
29
- },
30
- "properties": {
31
- "schema": {
32
- "type": "string",
33
- "description": "GraphQL schema SDL as a string. Canonical source of type definitions."
34
- },
35
- "queries": {
36
- "type": "array",
37
- "description": "Query operations exposed by the GraphQL API.",
38
- "items": {
39
- "$ref": "#/$defs/Operation"
40
- }
41
- },
42
- "mutations": {
43
- "type": "array",
44
- "description": "Mutation operations exposed by the GraphQL API.",
45
- "items": {
46
- "$ref": "#/$defs/Operation"
47
- }
48
- },
49
- "subscriptions": {
50
- "type": "array",
51
- "description": "Subscription operations exposed by the GraphQL API.",
52
- "items": {
53
- "$ref": "#/$defs/Operation"
54
- }
55
- }
56
- },
57
- "additionalProperties": false
58
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unispec.dev/schema/types/graphql.schema.json",
4
+ "title": "GraphQL API surface",
5
+ "type": "object",
6
+ "$defs": {
7
+ "Operation": {
8
+ "type": "object",
9
+ "required": ["name"],
10
+ "properties": {
11
+ "name": {
12
+ "$ref": "./common.schema.json#/$defs/Identifier"
13
+ },
14
+ "description": {
15
+ "$ref": "./common.schema.json#/$defs/Description"
16
+ },
17
+ "deprecated": {
18
+ "type": "boolean",
19
+ "description": "Marks the operation as deprecated.",
20
+ "default": false
21
+ },
22
+ "deprecationReason": {
23
+ "type": "string",
24
+ "description": "Human-readable reason for deprecation."
25
+ }
26
+ },
27
+ "additionalProperties": false
28
+ }
29
+ },
30
+ "properties": {
31
+ "schema": {
32
+ "type": "string",
33
+ "description": "GraphQL schema SDL as a string. Canonical source of type definitions."
34
+ },
35
+ "queries": {
36
+ "type": "array",
37
+ "description": "Query operations exposed by the GraphQL API.",
38
+ "items": {
39
+ "$ref": "#/$defs/Operation"
40
+ }
41
+ },
42
+ "mutations": {
43
+ "type": "array",
44
+ "description": "Mutation operations exposed by the GraphQL API.",
45
+ "items": {
46
+ "$ref": "#/$defs/Operation"
47
+ }
48
+ },
49
+ "subscriptions": {
50
+ "type": "array",
51
+ "description": "Subscription operations exposed by the GraphQL API.",
52
+ "items": {
53
+ "$ref": "#/$defs/Operation"
54
+ }
55
+ }
56
+ },
57
+ "additionalProperties": false
58
+ }