@unispechq/unispec-schema 0.4.2 → 0.4.3
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 +31 -10
- package/examples/README.md +38 -109
- package/examples/invalid/config/empty-services-array.json +4 -0
- package/examples/invalid/config/invalid-spec-reference.json +13 -0
- package/examples/invalid/config/missing-service-name.json +8 -21
- package/examples/invalid/config/missing-services.json +3 -0
- package/examples/invalid/config/missing-version.json +8 -5
- package/examples/invalid/spec/graphql-missing-arg-type.json +21 -0
- package/examples/invalid/spec/graphql-missing-name.json +22 -0
- package/examples/invalid/spec/invalid-identifier.json +23 -0
- package/examples/invalid/spec/invalid-rest-method.json +22 -0
- package/examples/invalid/spec/missing-service-name.json +22 -0
- package/examples/invalid/spec/missing-unispec-version.json +22 -0
- package/examples/valid/config/complete-enterprise.json +142 -0
- package/examples/valid/config/registry-based.json +40 -0
- package/examples/valid/config/simple-multi-service.json +58 -0
- package/examples/valid/spec/graphql-simple.json +48 -0
- package/examples/valid/spec/mixed-complete.json +163 -0
- package/examples/valid/spec/rest-simple.json +45 -0
- package/examples/valid/spec/websocket-simple.json +71 -0
- package/package.json +2 -2
- package/examples/invalid/config/additional-properties.json +0 -26
- package/examples/invalid/graphql-additional-properties.json +0 -22
- package/examples/invalid/graphql-missing-arg-type.json +0 -26
- package/examples/invalid/graphql-missing-name.json +0 -19
- package/examples/invalid/graphql-missing-schema.json +0 -19
- package/examples/invalid/mixed-invalid-protocol.json +0 -26
- package/examples/invalid/mixed-missing-graphql-schema.json +0 -33
- package/examples/invalid/mixed-multiple-errors.json +0 -41
- package/examples/invalid/rest-additional-properties.json +0 -25
- package/examples/invalid/rest-invalid-identifiers.json +0 -29
- package/examples/invalid/rest-invalid-method.json +0 -23
- package/examples/invalid/rest-missing-required.json +0 -21
- package/examples/invalid/websocket-additional-properties.json +0 -27
- package/examples/invalid/websocket-invalid-direction.json +0 -27
- package/examples/invalid/websocket-missing-channel-name.json +0 -25
- package/examples/invalid/websocket-missing-message-name.json +0 -25
- package/examples/valid/config/complete.json +0 -61
- package/examples/valid/config/minimal.json +0 -8
- package/examples/valid/graphql-complete.json +0 -348
- package/examples/valid/graphql-simple.json +0 -34
- package/examples/valid/mixed-complete.json +0 -799
- package/examples/valid/mixed-simple.json +0 -56
- package/examples/valid/rest-complete.json +0 -539
- package/examples/valid/rest-simple.json +0 -279
- package/examples/valid/websocket-complete.json +0 -471
- package/examples/valid/websocket-simple.json +0 -116
package/README.md
CHANGED
|
@@ -28,9 +28,20 @@ unispec-spec/
|
|
|
28
28
|
│ ├─ websocket.schema.json # WebSocket protocol
|
|
29
29
|
│ └─ schemas.schema.json # Reusable schemas
|
|
30
30
|
│
|
|
31
|
-
├─ examples/ # Real-world examples in
|
|
32
|
-
│ ├─
|
|
33
|
-
│
|
|
31
|
+
├─ examples/ # Real-world examples in JSON format
|
|
32
|
+
│ ├─ valid/ # Conforming examples
|
|
33
|
+
│ │ ├─ spec/ # Valid UniSpec specifications
|
|
34
|
+
│ │ │ ├─ rest-simple.json # Simple REST API
|
|
35
|
+
│ │ │ ├─ graphql-simple.json # GraphQL API
|
|
36
|
+
│ │ │ ├─ websocket-simple.json # WebSocket API
|
|
37
|
+
│ │ │ └─ mixed-complete.json # Multi-protocol API
|
|
38
|
+
│ │ └─ config/ # Valid configuration files
|
|
39
|
+
│ │ ├─ simple-multi-service.json
|
|
40
|
+
│ │ ├─ registry-based.json
|
|
41
|
+
│ │ └─ complete-enterprise.json
|
|
42
|
+
│ └─ invalid/ # Schema violations for testing
|
|
43
|
+
│ ├─ spec/ # Invalid specifications
|
|
44
|
+
│ └─ config/ # Invalid configurations
|
|
34
45
|
│
|
|
35
46
|
├─ docs/ # Detailed format documentation
|
|
36
47
|
│ ├─ unispec.md # UniSpec document format
|
|
@@ -112,14 +123,24 @@ The canonical, machine-readable definition of UniSpec lives in the schema/ direc
|
|
|
112
123
|
|
|
113
124
|
## Examples
|
|
114
125
|
|
|
115
|
-
The `examples/` directory contains
|
|
116
|
-
- `simple-rest.yaml` — minimal REST service
|
|
117
|
-
- `graphql.yaml` — GraphQL API
|
|
118
|
-
- `websocket.yaml` — WebSocket channels
|
|
119
|
-
- `mixed-api.yaml` — multi-protocol service
|
|
120
|
-
- `unispec.config.json` — configuration example
|
|
126
|
+
The `examples/` directory contains comprehensive examples in JSON format:
|
|
121
127
|
|
|
122
|
-
|
|
128
|
+
### Valid Examples (`examples/valid/`)
|
|
129
|
+
- **Specifications** (`spec/`):
|
|
130
|
+
- `rest-simple.json` — Simple REST user management service
|
|
131
|
+
- `graphql-simple.json` — GraphQL blog service
|
|
132
|
+
- `websocket-simple.json` — WebSocket chat service
|
|
133
|
+
- `mixed-complete.json` — Complete multi-protocol e-commerce service
|
|
134
|
+
- **Configurations** (`config/`):
|
|
135
|
+
- `simple-multi-service.json` — Basic multi-service setup
|
|
136
|
+
- `registry-based.json` — Configuration using registry references
|
|
137
|
+
- `complete-enterprise.json` — Full enterprise configuration with environments
|
|
138
|
+
|
|
139
|
+
### Invalid Examples (`examples/invalid/`)
|
|
140
|
+
- **Specifications** — Various schema violations for testing validation
|
|
141
|
+
- **Configurations** — Configuration validation errors
|
|
142
|
+
|
|
143
|
+
All examples are validated as part of CI. See [`examples/README.md`](examples/README.md) for detailed documentation.
|
|
123
144
|
|
|
124
145
|
## Versioning
|
|
125
146
|
|
package/examples/README.md
CHANGED
|
@@ -1,128 +1,57 @@
|
|
|
1
1
|
# UniSpec Examples
|
|
2
2
|
|
|
3
|
-
This directory contains
|
|
3
|
+
This directory contains example files demonstrating the UniSpec format and configuration.
|
|
4
4
|
|
|
5
5
|
## Structure
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- `valid/` - Examples that conform to the UniSpec schema
|
|
8
|
+
- `spec/` - Valid UniSpec specification files
|
|
9
|
+
- `config/` - Valid UniSpec configuration files
|
|
10
|
+
- `invalid/` - Examples that intentionally violate the schema for testing validation
|
|
11
|
+
- `spec/` - Invalid UniSpec specification files
|
|
12
|
+
- `config/` - Invalid UniSpec configuration files
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
## Valid Examples
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
- **`rest-complete.json`** - Complete user management API with authentication, pagination, schemas, and comprehensive error handling
|
|
13
|
-
- **`rest-simple.json`** - Simple blog API with basic CRUD operations
|
|
16
|
+
### Specification Files (`valid/spec/`)
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
+
- `rest-simple.json` - Simple REST API with user management
|
|
19
|
+
- `graphql-simple.json` - Basic GraphQL blog service
|
|
20
|
+
- `websocket-simple.json` - WebSocket chat service
|
|
21
|
+
- `mixed-complete.json` - Complete e-commerce service with REST, GraphQL, and WebSocket
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
- **`websocket-complete.json`** - Real-time chat API with multiple channels, authentication, reconnection strategies, and comprehensive message types
|
|
21
|
-
- **`websocket-simple.json`** - Simple notification and status update WebSocket API
|
|
23
|
+
### Configuration Files (`valid/config/`)
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
25
|
+
- `simple-multi-service.json` - Basic multi-service configuration
|
|
26
|
+
- `registry-based.json` - Configuration using registry references
|
|
27
|
+
- `complete-enterprise.json` - Full enterprise configuration with environments
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
- **`config/complete.json`** - Complete configuration with multiple services, environments, auth, and health checks
|
|
29
|
-
- **`config/minimal.json`** - Minimal configuration with single service
|
|
30
|
-
- **`config/unispec.config.json`** - Existing configuration example (JSON format)
|
|
29
|
+
## Invalid Examples
|
|
31
30
|
|
|
32
|
-
###
|
|
31
|
+
### Specification Files (`invalid/spec/`)
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
- `missing-unispec-version.json` - Missing required `unispecVersion` field
|
|
34
|
+
- `missing-service-name.json` - Missing required `service.name` field
|
|
35
|
+
- `invalid-rest-method.json` - Invalid HTTP method in REST route
|
|
36
|
+
- `graphql-missing-arg-type.json` - GraphQL argument missing type
|
|
37
|
+
- `graphql-missing-name.json` - GraphQL operation missing name
|
|
38
|
+
- `invalid-identifier.json` - Invalid identifier format
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
- **`rest-missing-required.json`** - Missing required fields (service name, route path)
|
|
38
|
-
- **`rest-invalid-method.json`** - Invalid HTTP method
|
|
39
|
-
- **`rest-invalid-identifiers.json`** - Invalid identifier patterns with spaces
|
|
40
|
-
- **`rest-additional-properties.json`** - Additional properties not allowed by schema
|
|
40
|
+
### Configuration Files (`invalid/config/`)
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
42
|
+
- `missing-version.json` - Missing required `version` field
|
|
43
|
+
- `missing-services.json` - Missing required `services` array
|
|
44
|
+
- `missing-service-name.json` - Service entry missing required `name` field
|
|
45
|
+
- `invalid-spec-reference.json` - Invalid spec reference type
|
|
46
|
+
- `empty-services-array.json` - Empty services array (violates minItems constraint)
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
- **`websocket-missing-channel-name.json`** - Missing required channel name
|
|
50
|
-
- **`websocket-missing-message-name.json`** - Missing required message name
|
|
51
|
-
- **`websocket-invalid-direction.json`** - Invalid direction enum values
|
|
52
|
-
- **`websocket-additional-properties.json`** - Additional properties not allowed
|
|
48
|
+
## Usage
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
- **`mixed-missing-graphql-schema.json`** - GraphQL protocol missing required schema
|
|
56
|
-
- **`mixed-invalid-protocol.json`** - Invalid protocol property
|
|
57
|
-
- **`mixed-multiple-errors.json`** - Multiple validation errors across protocols
|
|
50
|
+
These examples are intended for:
|
|
58
51
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
- **`config/unispec.config.json`** - Existing configuration example (for reference)
|
|
52
|
+
1. **Learning** - Understanding the UniSpec format structure
|
|
53
|
+
2. **Testing** - Validating UniSpec parsers and validators
|
|
54
|
+
3. **Reference** - Starting points for creating your own specifications
|
|
55
|
+
4. **Documentation** - Demonstrating various features and patterns
|
|
64
56
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
These examples are published as part of the `@unispechq/unispec-schema` package and can be imported:
|
|
68
|
-
|
|
69
|
-
```javascript
|
|
70
|
-
// Import all valid examples
|
|
71
|
-
import validExamples from '@unispechq/unispec-schema/examples/valid';
|
|
72
|
-
|
|
73
|
-
// Import specific example
|
|
74
|
-
import restComplete from '@unispechq/unispec-schema/examples/valid/rest-complete';
|
|
75
|
-
|
|
76
|
-
// Import invalid examples for testing validation
|
|
77
|
-
import invalidExamples from '@unispechq/unispec-schema/examples/invalid';
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Testing
|
|
81
|
-
|
|
82
|
-
Use these examples to test your UniSpec validation tools:
|
|
83
|
-
|
|
84
|
-
1. **Positive Testing**: Use valid examples to ensure your validator accepts correct specifications
|
|
85
|
-
2. **Negative Testing**: Use invalid examples to ensure your validator catches errors appropriately
|
|
86
|
-
3. **Edge Case Testing**: Test boundary conditions and complex scenarios with the complete examples
|
|
87
|
-
4. **Protocol Testing**: Validate specific protocol handling with individual REST, GraphQL, and WebSocket examples
|
|
88
|
-
|
|
89
|
-
## Coverage
|
|
90
|
-
|
|
91
|
-
The examples cover:
|
|
92
|
-
|
|
93
|
-
- ✅ All UniSpec protocols (REST, GraphQL, WebSocket)
|
|
94
|
-
- ✅ Authentication and security schemes
|
|
95
|
-
- ✅ Schema definitions and references
|
|
96
|
-
- ✅ Error handling and responses
|
|
97
|
-
- ✅ Pagination and filtering
|
|
98
|
-
- ✅ Real-time communication patterns
|
|
99
|
-
- ✅ Mixed protocol architectures
|
|
100
|
-
- ✅ Configuration management (YAML and JSON)
|
|
101
|
-
- ✅ Environment-specific configurations
|
|
102
|
-
- ✅ Service discovery and health checks
|
|
103
|
-
- ✅ Common validation errors
|
|
104
|
-
- ✅ Edge cases and complex scenarios
|
|
105
|
-
|
|
106
|
-
## Contributing
|
|
107
|
-
|
|
108
|
-
When adding new examples:
|
|
109
|
-
|
|
110
|
-
1. Place valid examples in `examples/valid/`
|
|
111
|
-
2. Place invalid examples in `examples/invalid/`
|
|
112
|
-
3. Use descriptive filenames
|
|
113
|
-
4. Add comments explaining the purpose of the example
|
|
114
|
-
5. Update this README file
|
|
115
|
-
6. Update `package.json` exports if adding new files
|
|
116
|
-
7. Test against the UniSpec schema
|
|
117
|
-
|
|
118
|
-
## Schema Validation
|
|
119
|
-
|
|
120
|
-
All examples should be validated against the UniSpec JSON Schema:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
# Validate a specific example
|
|
124
|
-
npx ajv validate -s schema/unispec.schema.json -d examples/valid/rest-complete.json
|
|
125
|
-
|
|
126
|
-
# Validate all examples
|
|
127
|
-
find examples -name "*.json" -exec npx ajv validate -s schema/unispec.schema.json -d {} \;
|
|
128
|
-
```
|
|
57
|
+
All examples are in JSON format for consistency and ease of validation against the JSON schemas.
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"name": "getUsers",
|
|
10
|
-
"path": "/users",
|
|
11
|
-
"method": "GET",
|
|
12
|
-
"responses": {
|
|
13
|
-
"200": {
|
|
14
|
-
"description": "Success"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"services": [
|
|
4
|
+
{
|
|
5
|
+
"baseUrl": "https://test.com",
|
|
6
|
+
"spec": "https://test.com/unispec.json"
|
|
7
|
+
}
|
|
8
|
+
]
|
|
22
9
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"unispecVersion": "1.0.0",
|
|
3
|
+
"service": {
|
|
4
|
+
"name": "invalid-graphql-service",
|
|
5
|
+
"protocols": {
|
|
6
|
+
"graphql": {
|
|
7
|
+
"queries": [
|
|
8
|
+
{
|
|
9
|
+
"name": "user",
|
|
10
|
+
"args": [
|
|
11
|
+
{
|
|
12
|
+
"name": "id"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"returnType": "User"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"unispecVersion": "1.0.0",
|
|
3
|
+
"service": {
|
|
4
|
+
"name": "invalid-graphql-service",
|
|
5
|
+
"protocols": {
|
|
6
|
+
"graphql": {
|
|
7
|
+
"queries": [
|
|
8
|
+
{
|
|
9
|
+
"description": "Missing operation name",
|
|
10
|
+
"args": [
|
|
11
|
+
{
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "ID!"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"returnType": "User"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"unispecVersion": "1.0.0",
|
|
3
|
+
"service": {
|
|
4
|
+
"name": "123invalid-service",
|
|
5
|
+
"description": "Invalid service name - starts with number",
|
|
6
|
+
"protocols": {
|
|
7
|
+
"rest": {
|
|
8
|
+
"routes": [
|
|
9
|
+
{
|
|
10
|
+
"name": "456invalid",
|
|
11
|
+
"path": "/test",
|
|
12
|
+
"method": "GET",
|
|
13
|
+
"responses": {
|
|
14
|
+
"200": {
|
|
15
|
+
"description": "OK"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"unispecVersion": "1.0.0",
|
|
3
|
+
"service": {
|
|
4
|
+
"name": "invalid-rest-service",
|
|
5
|
+
"protocols": {
|
|
6
|
+
"rest": {
|
|
7
|
+
"routes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "invalidMethod",
|
|
10
|
+
"path": "/test",
|
|
11
|
+
"method": "INVALID",
|
|
12
|
+
"responses": {
|
|
13
|
+
"200": {
|
|
14
|
+
"description": "OK"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"unispecVersion": "1.0.0",
|
|
3
|
+
"service": {
|
|
4
|
+
"description": "Missing required service name",
|
|
5
|
+
"protocols": {
|
|
6
|
+
"rest": {
|
|
7
|
+
"routes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "test",
|
|
10
|
+
"path": "/test",
|
|
11
|
+
"method": "GET",
|
|
12
|
+
"responses": {
|
|
13
|
+
"200": {
|
|
14
|
+
"description": "OK"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"service": {
|
|
3
|
+
"name": "invalid-service",
|
|
4
|
+
"description": "Missing unispecVersion field",
|
|
5
|
+
"protocols": {
|
|
6
|
+
"rest": {
|
|
7
|
+
"routes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "test",
|
|
10
|
+
"path": "/test",
|
|
11
|
+
"method": "GET",
|
|
12
|
+
"responses": {
|
|
13
|
+
"200": {
|
|
14
|
+
"description": "OK"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"services": [
|
|
4
|
+
{
|
|
5
|
+
"name": "auth-service",
|
|
6
|
+
"baseUrl": "https://auth.company.com",
|
|
7
|
+
"spec": {
|
|
8
|
+
"type": "http",
|
|
9
|
+
"url": "/unispec.json"
|
|
10
|
+
},
|
|
11
|
+
"health": {
|
|
12
|
+
"path": "/health"
|
|
13
|
+
},
|
|
14
|
+
"headers": [
|
|
15
|
+
{
|
|
16
|
+
"name": "Authorization",
|
|
17
|
+
"description": "Bearer token",
|
|
18
|
+
"required": true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "X-Request-ID",
|
|
22
|
+
"description": "Request tracking ID",
|
|
23
|
+
"required": false
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"security": [
|
|
27
|
+
[
|
|
28
|
+
"oauth2"
|
|
29
|
+
],
|
|
30
|
+
[
|
|
31
|
+
"apiKeyAuth"
|
|
32
|
+
]
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "catalog-service",
|
|
37
|
+
"baseUrl": "https://catalog.company.com",
|
|
38
|
+
"spec": {
|
|
39
|
+
"type": "file",
|
|
40
|
+
"path": "./specs/catalog.json"
|
|
41
|
+
},
|
|
42
|
+
"health": {
|
|
43
|
+
"path": "/ping"
|
|
44
|
+
},
|
|
45
|
+
"discovery": {
|
|
46
|
+
"dnsTemplate": "catalog-{env}.company.com"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "notification-service",
|
|
51
|
+
"baseUrl": "https://notifications.company.com",
|
|
52
|
+
"spec": {
|
|
53
|
+
"type": "registry",
|
|
54
|
+
"ref": "notification-service@v2.1.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"environments": [
|
|
59
|
+
{
|
|
60
|
+
"name": "development",
|
|
61
|
+
"overrides": {
|
|
62
|
+
"services": {
|
|
63
|
+
"auth-service": {
|
|
64
|
+
"baseUrl": "http://localhost:8000"
|
|
65
|
+
},
|
|
66
|
+
"catalog-service": {
|
|
67
|
+
"baseUrl": "http://localhost:8001"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"observability": {
|
|
72
|
+
"logging": {
|
|
73
|
+
"level": "debug"
|
|
74
|
+
},
|
|
75
|
+
"tracing": {
|
|
76
|
+
"enabled": true,
|
|
77
|
+
"samplingRate": 1
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "staging",
|
|
83
|
+
"overrides": {
|
|
84
|
+
"services": {
|
|
85
|
+
"auth-service": {
|
|
86
|
+
"baseUrl": "https://staging-auth.company.com"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"observability": {
|
|
91
|
+
"logging": {
|
|
92
|
+
"level": "info"
|
|
93
|
+
},
|
|
94
|
+
"metrics": {
|
|
95
|
+
"enabled": true,
|
|
96
|
+
"endpoints": [
|
|
97
|
+
"/metrics"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"deployment": {
|
|
102
|
+
"kubernetes": {
|
|
103
|
+
"namespace": "staging",
|
|
104
|
+
"replicas": 2
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "production",
|
|
110
|
+
"observability": {
|
|
111
|
+
"logging": {
|
|
112
|
+
"level": "warn",
|
|
113
|
+
"format": "json"
|
|
114
|
+
},
|
|
115
|
+
"metrics": {
|
|
116
|
+
"enabled": true
|
|
117
|
+
},
|
|
118
|
+
"tracing": {
|
|
119
|
+
"enabled": true,
|
|
120
|
+
"samplingRate": 0.01
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"deployment": {
|
|
124
|
+
"kubernetes": {
|
|
125
|
+
"namespace": "production",
|
|
126
|
+
"replicas": 5,
|
|
127
|
+
"serviceType": "LoadBalancer"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"dataResidency": "EU-West",
|
|
131
|
+
"audit": {
|
|
132
|
+
"enabled": true,
|
|
133
|
+
"retention": "1 year",
|
|
134
|
+
"fields": [
|
|
135
|
+
"userId",
|
|
136
|
+
"action",
|
|
137
|
+
"timestamp"
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"services": [
|
|
4
|
+
{
|
|
5
|
+
"name": "payment-service",
|
|
6
|
+
"baseUrl": "https://payments.example.com",
|
|
7
|
+
"spec": {
|
|
8
|
+
"type": "registry",
|
|
9
|
+
"ref": "payment-service@v1.2.3"
|
|
10
|
+
},
|
|
11
|
+
"headers": [
|
|
12
|
+
{
|
|
13
|
+
"name": "X-API-Key",
|
|
14
|
+
"description": "API key for payment service",
|
|
15
|
+
"required": true
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"security": [
|
|
19
|
+
[
|
|
20
|
+
"apiKeyAuth"
|
|
21
|
+
]
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"discovery": {
|
|
26
|
+
"dnsTemplate": "{service}.{env}.example.com"
|
|
27
|
+
},
|
|
28
|
+
"environments": [
|
|
29
|
+
{
|
|
30
|
+
"name": "staging",
|
|
31
|
+
"overrides": {
|
|
32
|
+
"services": {
|
|
33
|
+
"payment-service": {
|
|
34
|
+
"baseUrl": "https://staging-payments.example.com"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"services": [
|
|
4
|
+
{
|
|
5
|
+
"name": "user-service",
|
|
6
|
+
"baseUrl": "https://user-api.example.com",
|
|
7
|
+
"spec": {
|
|
8
|
+
"type": "http",
|
|
9
|
+
"url": "https://user-api.example.com/unispec.json"
|
|
10
|
+
},
|
|
11
|
+
"health": {
|
|
12
|
+
"path": "/health"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "order-service",
|
|
17
|
+
"baseUrl": "https://order-api.example.com",
|
|
18
|
+
"spec": {
|
|
19
|
+
"type": "file",
|
|
20
|
+
"path": "./order-service-spec.json"
|
|
21
|
+
},
|
|
22
|
+
"health": {
|
|
23
|
+
"path": "/ping"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"environments": [
|
|
28
|
+
{
|
|
29
|
+
"name": "development",
|
|
30
|
+
"overrides": {
|
|
31
|
+
"services": {
|
|
32
|
+
"user-service": {
|
|
33
|
+
"baseUrl": "http://localhost:3001"
|
|
34
|
+
},
|
|
35
|
+
"order-service": {
|
|
36
|
+
"baseUrl": "http://localhost:3002"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "production",
|
|
43
|
+
"observability": {
|
|
44
|
+
"logging": {
|
|
45
|
+
"level": "info",
|
|
46
|
+
"format": "json"
|
|
47
|
+
},
|
|
48
|
+
"metrics": {
|
|
49
|
+
"enabled": true
|
|
50
|
+
},
|
|
51
|
+
"tracing": {
|
|
52
|
+
"enabled": true,
|
|
53
|
+
"samplingRate": 0.1
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|