@specverse/engines 5.0.2 → 5.1.0
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/dist/ai/commands/fill.d.ts.map +1 -1
- package/dist/ai/commands/fill.js +16 -7
- package/dist/ai/commands/fill.js.map +1 -1
- package/dist/ai/commands/template.d.ts.map +1 -1
- package/dist/ai/commands/template.js +17 -8
- package/dist/ai/commands/template.js.map +1 -1
- package/dist/bundles/deriveCatalog.d.ts +18 -0
- package/dist/bundles/deriveCatalog.d.ts.map +1 -0
- package/dist/bundles/deriveCatalog.js +263 -0
- package/dist/bundles/deriveCatalog.js.map +1 -0
- package/dist/bundles/index.d.ts +15 -0
- package/dist/bundles/index.d.ts.map +1 -0
- package/dist/bundles/index.js +15 -0
- package/dist/bundles/index.js.map +1 -0
- package/dist/bundles/types.d.ts +53 -0
- package/dist/bundles/types.d.ts.map +1 -0
- package/dist/bundles/types.js +22 -0
- package/dist/bundles/types.js.map +1 -0
- package/dist/bundles/validate.d.ts +55 -0
- package/dist/bundles/validate.d.ts.map +1 -0
- package/dist/bundles/validate.js +471 -0
- package/dist/bundles/validate.js.map +1 -0
- package/dist/inference/quint-transpiler.js +2 -2
- package/dist/inference/quint-transpiler.js.map +1 -1
- package/dist/libs/instance-factories/applications/templates/react/runtime-package-json-generator.js +1 -1
- package/dist/libs/instance-factories/cli/templates/commander/command-generator.js +43 -0
- package/dist/libs/instance-factories/tools/templates/mcp/mcp-server-generator.js +11 -4
- package/libs/instance-factories/applications/templates/react/runtime-package-json-generator.ts +1 -1
- package/libs/instance-factories/cli/templates/commander/command-generator.ts +43 -0
- package/libs/instance-factories/tools/templates/mcp/mcp-server-generator.ts +10 -3
- package/package.json +9 -5
- package/assets/examples/09-api/ai-spec.yaml +0 -194
- package/assets/examples/09-api/converted.yaml +0 -95
- package/assets/examples/09-api/diagram-architecture.mmd +0 -10
- package/assets/examples/09-api/diagram-er.mmd +0 -10
- package/assets/examples/09-api/documentation.html +0 -104
- package/assets/examples/09-api/documentation.md +0 -95
- package/assets/examples/09-api/inferred-spec.yaml +0 -420
- package/assets/examples/09-api/openapi.json +0 -61
- package/assets/examples/10-api/README.md +0 -216
- package/assets/examples/10-api/ai-spec.yaml +0 -194
- package/assets/examples/10-api/converted.yaml +0 -96
- package/assets/examples/10-api/diagram-architecture.mmd +0 -10
- package/assets/examples/10-api/diagram-er.mmd +0 -10
- package/assets/examples/10-api/documentation.html +0 -104
- package/assets/examples/10-api/documentation.md +0 -95
- package/assets/examples/10-api/inferred-spec.yaml +0 -7
- package/assets/examples/10-api/metadata.yaml +0 -89
- package/assets/examples/10-api/openapi.json +0 -61
- package/assets/examples/10-api/package-integration-test.js +0 -177
- package/assets/examples/10-api/usage-example.js +0 -323
- package/assets/examples/10-api/usage-example.ts +0 -363
- package/assets/examples/10-api/workflow-test.js +0 -113
- package/assets/examples/validate-examples-with-expected-failures.cjs +0 -328
- package/assets/examples/validate-examples.cjs +0 -225
- package/assets/prompts/MOVED.md +0 -35
- package/assets/prompts/SUMMARY-v8-PROMOTION.md +0 -445
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
# 09-API: SpecVerse API Integration Examples
|
|
2
|
-
|
|
3
|
-
These are complete examples for programmatic usage of the SpecVerse Language API in TypeScript and JavaScript applications.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
This directory contains comprehensive API integration examples demonstrating how to use SpecVerse programmatically in your applications. These examples cover the complete workflow from parsing specifications to generating code and documentation.
|
|
8
|
-
|
|
9
|
-
## Files Overview
|
|
10
|
-
|
|
11
|
-
- specverse-lang/examples/10-api/usage-example.js
|
|
12
|
-
- specverse-lang/examples/10-api/usage-example.ts
|
|
13
|
-
|
|
14
|
-
**Comprehensive API usage examples** showing the complete SpecVerse workflow:
|
|
15
|
-
|
|
16
|
-
- **Parsing**: Load and validate .specly files
|
|
17
|
-
- **AI Inference**: Run logical inference to enhance specifications
|
|
18
|
-
- **Code Generation**: Generate diagrams, documentation, and YAML output
|
|
19
|
-
- **Error Handling**: Proper error management patterns
|
|
20
|
-
- **Full Workflow**: End-to-end specification processing
|
|
21
|
-
|
|
22
|
-
**Best for**: Learning the API, understanding all capabilities, integration planning
|
|
23
|
-
|
|
24
|
-
<!-- ### **"[workflow-test.js]"**a -->
|
|
25
|
-
- specverse-lang/examples/10-api/workflow-test.js
|
|
26
|
-
|
|
27
|
-
**Focused end-to-end workflow test** for production validation:
|
|
28
|
-
|
|
29
|
-
- **Quick Testing**: Minimal test for API functionality validation
|
|
30
|
-
- **CI/CD Integration**: Suitable for automated testing pipelines
|
|
31
|
-
- **Error Reporting**: Clear success/failure indicators with actionable feedback
|
|
32
|
-
- **Self-Contained**: Includes embedded test specification
|
|
33
|
-
|
|
34
|
-
**Best for**: CI/CD pipelines, automated testing, quick API health checks
|
|
35
|
-
|
|
36
|
-
<!-- ### **[package-integration-test.js](./package-integration-test.js)** -->
|
|
37
|
-
- specverse-lang/examples/10-api/package-integration-test.js
|
|
38
|
-
**npm package installation and integration test**:
|
|
39
|
-
|
|
40
|
-
- **Package Testing**: Validates complete npm installation workflow
|
|
41
|
-
- **Real-world Simulation**: Tests actual published package usage
|
|
42
|
-
- **API Verification**: Confirms all API features work after installation
|
|
43
|
-
- **Integration Validation**: End-to-end package integration testing
|
|
44
|
-
|
|
45
|
-
**Best for**: Release validation, package testing, integration verification
|
|
46
|
-
|
|
47
|
-
## Getting Started
|
|
48
|
-
|
|
49
|
-
### Quick Start
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
# Run comprehensive API examples
|
|
53
|
-
node examples/10-api/usage-example.js
|
|
54
|
-
|
|
55
|
-
# Run focused workflow test
|
|
56
|
-
node examples/10-api/workflow-test.js
|
|
57
|
-
|
|
58
|
-
# Run package integration test
|
|
59
|
-
node examples/10-api/package-integration-test.js
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Integration in Your Project
|
|
63
|
-
|
|
64
|
-
1. **Install SpecVerse Language**:
|
|
65
|
-
```bash
|
|
66
|
-
npm install @specverse/lang
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2. **Copy and adapt examples**:
|
|
70
|
-
- Start with `usage-example.js` or `usage-example.ts`
|
|
71
|
-
- Modify for your specific use case
|
|
72
|
-
- Use `workflow-test.js` for testing integration
|
|
73
|
-
|
|
74
|
-
3. **Key API Components**:
|
|
75
|
-
```javascript
|
|
76
|
-
import { SpecVerseParser, LogicalInferenceEngine, UMLDiagramGenerator } from '@specverse/engines/parser';
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## API Features Demonstrated
|
|
80
|
-
|
|
81
|
-
### 🔧 Core Parsing
|
|
82
|
-
- Load and validate SpecVerse specifications
|
|
83
|
-
- Schema validation with comprehensive error reporting
|
|
84
|
-
- Convention processing and normalization
|
|
85
|
-
|
|
86
|
-
### 🤖 AI Inference Engine
|
|
87
|
-
- Logical inference for architecture generation
|
|
88
|
-
- Controller, service, and event generation
|
|
89
|
-
- Relationship inference and optimization
|
|
90
|
-
|
|
91
|
-
### 📊 Code Generation
|
|
92
|
-
- UML diagram generation (ER, Architecture, Sequence, Lifecycle)
|
|
93
|
-
- YAML output generation
|
|
94
|
-
- Documentation generation
|
|
95
|
-
|
|
96
|
-
### ⚡ Error Handling
|
|
97
|
-
- Comprehensive error reporting
|
|
98
|
-
- Validation feedback
|
|
99
|
-
- Processing diagnostics
|
|
100
|
-
|
|
101
|
-
## Integration Patterns
|
|
102
|
-
|
|
103
|
-
### Web Applications
|
|
104
|
-
```javascript
|
|
105
|
-
// React/Vue/Angular integration
|
|
106
|
-
import { SpecVerseParser } from '@specverse/engines/parser';
|
|
107
|
-
|
|
108
|
-
const parser = new SpecVerseParser(schema);
|
|
109
|
-
const result = parser.parseContent(specContent, 'component.specly');
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Build Tools
|
|
113
|
-
```javascript
|
|
114
|
-
// webpack/vite plugin integration
|
|
115
|
-
const { processSpecification } = require('@specverse/lang');
|
|
116
|
-
|
|
117
|
-
// In build pipeline
|
|
118
|
-
const output = await processSpecification(inputPath, outputPath);
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### API Services
|
|
122
|
-
```javascript
|
|
123
|
-
// Express/Fastify API endpoint
|
|
124
|
-
app.post('/api/specverse/validate', async (req, res) => {
|
|
125
|
-
const result = await validateSpecification(req.body.spec);
|
|
126
|
-
res.json(result);
|
|
127
|
-
});
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### CLI Tools
|
|
131
|
-
```javascript
|
|
132
|
-
// Custom CLI tool integration
|
|
133
|
-
#!/usr/bin/env node
|
|
134
|
-
const { SpecVerseParser } = require('@specverse/lang');
|
|
135
|
-
// Custom CLI implementation
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Testing Integration
|
|
139
|
-
|
|
140
|
-
All API examples are integrated into the SpecVerse test suite:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
# Run API tests as part of main test suite
|
|
144
|
-
npm test
|
|
145
|
-
|
|
146
|
-
# Run API tests individually
|
|
147
|
-
npm run test:api # workflow-test.js
|
|
148
|
-
npm run test:api:package # package-integration-test.js
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## TypeScript Support
|
|
152
|
-
|
|
153
|
-
SpecVerse provides complete TypeScript definitions:
|
|
154
|
-
|
|
155
|
-
```typescript
|
|
156
|
-
import {
|
|
157
|
-
SpecVerseParser,
|
|
158
|
-
LogicalInferenceEngine,
|
|
159
|
-
ParseResult,
|
|
160
|
-
InferenceConfig
|
|
161
|
-
} from '@specverse/engines/parser';
|
|
162
|
-
|
|
163
|
-
const parser: SpecVerseParser = new SpecVerseParser(schema);
|
|
164
|
-
const result: ParseResult = parser.parseContent(content, filename);
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Error Handling Patterns
|
|
168
|
-
|
|
169
|
-
### Validation Errors
|
|
170
|
-
```javascript
|
|
171
|
-
try {
|
|
172
|
-
const result = parser.parseContent(content, filename);
|
|
173
|
-
if (!result.success) {
|
|
174
|
-
console.error('Validation failed:', result.errors);
|
|
175
|
-
}
|
|
176
|
-
} catch (error) {
|
|
177
|
-
console.error('Parse error:', error.message);
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Inference Errors
|
|
182
|
-
```javascript
|
|
183
|
-
try {
|
|
184
|
-
const inference = await engine.inferLogicalSpecification(models, componentName);
|
|
185
|
-
} catch (error) {
|
|
186
|
-
if (error.code === 'INFERENCE_FAILED') {
|
|
187
|
-
// Handle inference-specific errors
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
## Performance Considerations
|
|
193
|
-
|
|
194
|
-
- **Parsing**: Sub-5ms for typical specifications
|
|
195
|
-
- **Inference**: Highly optimized rule processing
|
|
196
|
-
- **Memory**: Efficient rule loading and caching
|
|
197
|
-
- **Concurrent**: Safe for concurrent processing
|
|
198
|
-
|
|
199
|
-
## Next Steps
|
|
200
|
-
|
|
201
|
-
After exploring these API examples:
|
|
202
|
-
|
|
203
|
-
1. **Integrate**: Add SpecVerse to your project
|
|
204
|
-
2. **Customize**: Adapt examples to your use case
|
|
205
|
-
3. **Test**: Use workflow-test.js pattern for validation
|
|
206
|
-
4. **Deploy**: Use package-integration-test.js for release validation
|
|
207
|
-
|
|
208
|
-
## Related Documentation
|
|
209
|
-
|
|
210
|
-
- [Main Examples](../) - Learning examples and language features
|
|
211
|
-
- [CLI Reference](/reference/cli) - Command-line interface
|
|
212
|
-
- [API Documentation](https://specverse.dev/api/) - Complete API reference
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
**💡 Pro Tip**: Start with `usage-example.js` to understand the complete API, then use `workflow-test.js` patterns for production integration!
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
metadata:
|
|
2
|
-
component: SpecVerseFundamentals
|
|
3
|
-
version: 1.0.0
|
|
4
|
-
description: 'Example 01-01: Basic model definition with attributes'
|
|
5
|
-
tags: []
|
|
6
|
-
imports:
|
|
7
|
-
- from: '@specverse/primitives'
|
|
8
|
-
select:
|
|
9
|
-
- Money
|
|
10
|
-
exports: []
|
|
11
|
-
models:
|
|
12
|
-
- name: Product
|
|
13
|
-
attributes:
|
|
14
|
-
- name: id
|
|
15
|
-
type: UUID
|
|
16
|
-
constraints:
|
|
17
|
-
required: true
|
|
18
|
-
unique: false
|
|
19
|
-
pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
|
|
20
|
-
format: uuid
|
|
21
|
-
dbMapping:
|
|
22
|
-
columnName: id
|
|
23
|
-
columnType: UUID
|
|
24
|
-
index: false
|
|
25
|
-
nullable: false
|
|
26
|
-
validation:
|
|
27
|
-
rules:
|
|
28
|
-
- required
|
|
29
|
-
metadata:
|
|
30
|
-
encrypted: false
|
|
31
|
-
audit: false
|
|
32
|
-
- name: name
|
|
33
|
-
type: String
|
|
34
|
-
constraints:
|
|
35
|
-
required: true
|
|
36
|
-
unique: false
|
|
37
|
-
dbMapping:
|
|
38
|
-
columnName: name
|
|
39
|
-
columnType: VARCHAR(255)
|
|
40
|
-
index: false
|
|
41
|
-
nullable: false
|
|
42
|
-
validation:
|
|
43
|
-
rules:
|
|
44
|
-
- required
|
|
45
|
-
metadata:
|
|
46
|
-
encrypted: false
|
|
47
|
-
audit: false
|
|
48
|
-
- name: summary
|
|
49
|
-
type: String
|
|
50
|
-
constraints:
|
|
51
|
-
required: false
|
|
52
|
-
unique: false
|
|
53
|
-
dbMapping:
|
|
54
|
-
columnName: summary
|
|
55
|
-
columnType: VARCHAR(255)
|
|
56
|
-
index: false
|
|
57
|
-
nullable: true
|
|
58
|
-
validation:
|
|
59
|
-
rules: []
|
|
60
|
-
metadata:
|
|
61
|
-
encrypted: false
|
|
62
|
-
audit: false
|
|
63
|
-
- name: price
|
|
64
|
-
type: Money
|
|
65
|
-
constraints:
|
|
66
|
-
required: true
|
|
67
|
-
unique: false
|
|
68
|
-
dbMapping:
|
|
69
|
-
columnName: price
|
|
70
|
-
columnType: VARCHAR(255)
|
|
71
|
-
index: false
|
|
72
|
-
nullable: false
|
|
73
|
-
validation:
|
|
74
|
-
rules:
|
|
75
|
-
- required
|
|
76
|
-
metadata:
|
|
77
|
-
encrypted: false
|
|
78
|
-
audit: false
|
|
79
|
-
- name: inStock
|
|
80
|
-
type: Boolean
|
|
81
|
-
constraints:
|
|
82
|
-
required: false
|
|
83
|
-
unique: false
|
|
84
|
-
dbMapping:
|
|
85
|
-
columnName: in_stock
|
|
86
|
-
columnType: BOOLEAN
|
|
87
|
-
index: false
|
|
88
|
-
nullable: true
|
|
89
|
-
defaultValue: 'true'
|
|
90
|
-
validation:
|
|
91
|
-
rules: []
|
|
92
|
-
metadata:
|
|
93
|
-
encrypted: false
|
|
94
|
-
audit: false
|
|
95
|
-
- name: category
|
|
96
|
-
type: String
|
|
97
|
-
constraints:
|
|
98
|
-
required: true
|
|
99
|
-
unique: false
|
|
100
|
-
dbMapping:
|
|
101
|
-
columnName: category
|
|
102
|
-
columnType: VARCHAR(255)
|
|
103
|
-
index: false
|
|
104
|
-
nullable: false
|
|
105
|
-
validation:
|
|
106
|
-
rules:
|
|
107
|
-
- required
|
|
108
|
-
metadata:
|
|
109
|
-
encrypted: false
|
|
110
|
-
audit: false
|
|
111
|
-
- name: contactEmail
|
|
112
|
-
type: Email
|
|
113
|
-
constraints:
|
|
114
|
-
required: false
|
|
115
|
-
unique: false
|
|
116
|
-
pattern: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
|
|
117
|
-
format: email
|
|
118
|
-
dbMapping:
|
|
119
|
-
columnName: contact_email
|
|
120
|
-
columnType: VARCHAR(255)
|
|
121
|
-
index: false
|
|
122
|
-
nullable: true
|
|
123
|
-
validation:
|
|
124
|
-
rules:
|
|
125
|
-
- email
|
|
126
|
-
metadata:
|
|
127
|
-
encrypted: false
|
|
128
|
-
audit: false
|
|
129
|
-
relationships: []
|
|
130
|
-
behaviors:
|
|
131
|
-
- name: attachProfile
|
|
132
|
-
signature: 'attachProfile(profileName: String): Promise<Boolean>'
|
|
133
|
-
implementation:
|
|
134
|
-
preconditions:
|
|
135
|
-
- Profile exists and is compatible with this model
|
|
136
|
-
postconditions:
|
|
137
|
-
- Profile is attached
|
|
138
|
-
- Profile attributes are available
|
|
139
|
-
sideEffects: []
|
|
140
|
-
steps: []
|
|
141
|
-
transactional: true
|
|
142
|
-
metadata:
|
|
143
|
-
async: true
|
|
144
|
-
cacheable: false
|
|
145
|
-
idempotent: false
|
|
146
|
-
- name: detachProfile
|
|
147
|
-
signature: 'detachProfile(profileName: String): Promise<Boolean>'
|
|
148
|
-
implementation:
|
|
149
|
-
preconditions:
|
|
150
|
-
- Profile is currently attached
|
|
151
|
-
postconditions:
|
|
152
|
-
- Profile is detached
|
|
153
|
-
- Profile attributes are no longer available
|
|
154
|
-
sideEffects: []
|
|
155
|
-
steps: []
|
|
156
|
-
transactional: true
|
|
157
|
-
metadata:
|
|
158
|
-
async: true
|
|
159
|
-
cacheable: false
|
|
160
|
-
idempotent: false
|
|
161
|
-
- name: hasProfile
|
|
162
|
-
signature: 'hasProfile(profileName: String): Promise<Boolean>'
|
|
163
|
-
implementation:
|
|
164
|
-
preconditions: []
|
|
165
|
-
postconditions: []
|
|
166
|
-
sideEffects: []
|
|
167
|
-
steps: []
|
|
168
|
-
transactional: false
|
|
169
|
-
metadata:
|
|
170
|
-
async: true
|
|
171
|
-
cacheable: false
|
|
172
|
-
idempotent: false
|
|
173
|
-
lifecycle:
|
|
174
|
-
states: []
|
|
175
|
-
transitions: {}
|
|
176
|
-
currentStateField: state
|
|
177
|
-
dbMapping:
|
|
178
|
-
tableName: products
|
|
179
|
-
indexes: []
|
|
180
|
-
controllers: []
|
|
181
|
-
services: []
|
|
182
|
-
views: []
|
|
183
|
-
events: []
|
|
184
|
-
infrastructure:
|
|
185
|
-
database:
|
|
186
|
-
type: postgresql
|
|
187
|
-
migrations: true
|
|
188
|
-
seedData: false
|
|
189
|
-
messaging:
|
|
190
|
-
type: rabbitmq
|
|
191
|
-
queues: []
|
|
192
|
-
caching:
|
|
193
|
-
type: redis
|
|
194
|
-
ttl: 3600
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
components:
|
|
2
|
-
SpecVerseFundamentals:
|
|
3
|
-
version: 1.0.0
|
|
4
|
-
description: "Example 01-01: Basic model definition with attributes"
|
|
5
|
-
import:
|
|
6
|
-
- from: "@specverse/primitives"
|
|
7
|
-
select:
|
|
8
|
-
- Money
|
|
9
|
-
export:
|
|
10
|
-
models:
|
|
11
|
-
- Product
|
|
12
|
-
models:
|
|
13
|
-
Product:
|
|
14
|
-
description: Simple product with basic attributes
|
|
15
|
-
attributes:
|
|
16
|
-
id:
|
|
17
|
-
name: id
|
|
18
|
-
type: UUID
|
|
19
|
-
required: true
|
|
20
|
-
unique: false
|
|
21
|
-
name:
|
|
22
|
-
name: name
|
|
23
|
-
type: String
|
|
24
|
-
required: true
|
|
25
|
-
unique: false
|
|
26
|
-
summary:
|
|
27
|
-
name: summary
|
|
28
|
-
type: String
|
|
29
|
-
required: false
|
|
30
|
-
unique: false
|
|
31
|
-
price:
|
|
32
|
-
name: price
|
|
33
|
-
type: Money
|
|
34
|
-
required: true
|
|
35
|
-
unique: false
|
|
36
|
-
inStock:
|
|
37
|
-
name: inStock
|
|
38
|
-
type: Boolean
|
|
39
|
-
required: false
|
|
40
|
-
unique: false
|
|
41
|
-
default: "true"
|
|
42
|
-
category:
|
|
43
|
-
name: category
|
|
44
|
-
type: String
|
|
45
|
-
required: true
|
|
46
|
-
unique: false
|
|
47
|
-
values:
|
|
48
|
-
- electronics
|
|
49
|
-
- books
|
|
50
|
-
- clothing
|
|
51
|
-
- home
|
|
52
|
-
contactEmail:
|
|
53
|
-
name: contactEmail
|
|
54
|
-
type: Email
|
|
55
|
-
required: false
|
|
56
|
-
unique: false
|
|
57
|
-
behaviors:
|
|
58
|
-
attachProfile:
|
|
59
|
-
description: Attach a profile to this model instance
|
|
60
|
-
parameters:
|
|
61
|
-
profileName:
|
|
62
|
-
name: profileName
|
|
63
|
-
type: String
|
|
64
|
-
required: true
|
|
65
|
-
unique: false
|
|
66
|
-
returns: Boolean
|
|
67
|
-
requires:
|
|
68
|
-
- Profile exists and is compatible with this model
|
|
69
|
-
ensures:
|
|
70
|
-
- Profile is attached
|
|
71
|
-
- Profile attributes are available
|
|
72
|
-
detachProfile:
|
|
73
|
-
description: Detach a profile from this model instance
|
|
74
|
-
parameters:
|
|
75
|
-
profileName:
|
|
76
|
-
name: profileName
|
|
77
|
-
type: String
|
|
78
|
-
required: true
|
|
79
|
-
unique: false
|
|
80
|
-
returns: Boolean
|
|
81
|
-
requires:
|
|
82
|
-
- Profile is currently attached
|
|
83
|
-
ensures:
|
|
84
|
-
- Profile is detached
|
|
85
|
-
- Profile attributes are no longer available
|
|
86
|
-
hasProfile:
|
|
87
|
-
description: Check if a profile is attached to this model instance
|
|
88
|
-
parameters:
|
|
89
|
-
profileName:
|
|
90
|
-
name: profileName
|
|
91
|
-
type: String
|
|
92
|
-
required: true
|
|
93
|
-
unique: false
|
|
94
|
-
returns: Boolean
|
|
95
|
-
deployments: {}
|
|
96
|
-
manifests: {}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>SpecVerseFundamentals Documentation</title>
|
|
7
|
-
<style>
|
|
8
|
-
body {
|
|
9
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
10
|
-
line-height: 1.6;
|
|
11
|
-
color: #333;
|
|
12
|
-
max-width: 900px;
|
|
13
|
-
margin: 0 auto;
|
|
14
|
-
padding: 20px;
|
|
15
|
-
}
|
|
16
|
-
h1, h2, h3, h4, h5 {
|
|
17
|
-
color: #2c3e50;
|
|
18
|
-
margin-top: 1.5em;
|
|
19
|
-
}
|
|
20
|
-
h1 { border-bottom: 2px solid #3498db; padding-bottom: 0.3em; }
|
|
21
|
-
h2 { border-bottom: 1px solid #ecf0f1; padding-bottom: 0.2em; }
|
|
22
|
-
table {
|
|
23
|
-
border-collapse: collapse;
|
|
24
|
-
width: 100%;
|
|
25
|
-
margin: 1em 0;
|
|
26
|
-
}
|
|
27
|
-
th, td {
|
|
28
|
-
border: 1px solid #ddd;
|
|
29
|
-
padding: 8px;
|
|
30
|
-
text-align: left;
|
|
31
|
-
}
|
|
32
|
-
th {
|
|
33
|
-
background-color: #f8f9fa;
|
|
34
|
-
font-weight: bold;
|
|
35
|
-
}
|
|
36
|
-
code {
|
|
37
|
-
background-color: #f4f4f4;
|
|
38
|
-
padding: 2px 4px;
|
|
39
|
-
border-radius: 3px;
|
|
40
|
-
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
|
41
|
-
}
|
|
42
|
-
pre {
|
|
43
|
-
background-color: #f4f4f4;
|
|
44
|
-
padding: 1em;
|
|
45
|
-
border-radius: 5px;
|
|
46
|
-
overflow-x: auto;
|
|
47
|
-
}
|
|
48
|
-
.toc {
|
|
49
|
-
background-color: #f8f9fa;
|
|
50
|
-
padding: 1em;
|
|
51
|
-
border-radius: 5px;
|
|
52
|
-
margin: 1em 0;
|
|
53
|
-
}
|
|
54
|
-
.toc ul {
|
|
55
|
-
list-style-type: none;
|
|
56
|
-
padding-left: 1em;
|
|
57
|
-
}
|
|
58
|
-
.toc a {
|
|
59
|
-
text-decoration: none;
|
|
60
|
-
color: #3498db;
|
|
61
|
-
}
|
|
62
|
-
.toc a:hover {
|
|
63
|
-
text-decoration: underline;
|
|
64
|
-
}
|
|
65
|
-
hr {
|
|
66
|
-
border: none;
|
|
67
|
-
border-top: 1px solid #ecf0f1;
|
|
68
|
-
margin: 2em 0;
|
|
69
|
-
}
|
|
70
|
-
</style>
|
|
71
|
-
</head>
|
|
72
|
-
<body>
|
|
73
|
-
<h1>SpecVerseFundamentals</h1><p>Example 01-01: Basic model definition with attributes</p><p><strong>Version:</strong> 1.0.0
|
|
74
|
-
<strong>Generated:</strong> 2026-03-23T18:22:33.405Z</p><h2>Table of Contents</h2><ul><li><a href="#overview">Overview</a></li>
|
|
75
|
-
<li><a href="#models">Models</a></li>
|
|
76
|
-
- <a href="#product">Product</a></p><h2>Overview</h2><h3>Component Statistics</h3><p><tr><td>Component Type</td><td>Count</td></tr>
|
|
77
|
-
|
|
78
|
-
<tr><td>Models</td><td>1</td></tr>
|
|
79
|
-
<tr><td>Controllers</td><td>0</td></tr>
|
|
80
|
-
<tr><td>Services</td><td>0</td></tr>
|
|
81
|
-
<tr><td>Views</td><td>0</td></tr>
|
|
82
|
-
<tr><td>Events</td><td>0</td></tr></p><h3>Imports</h3><p>
|
|
83
|
-
<h3>Exports</h3><p><strong>SpecVerseFundamentals:</strong>
|
|
84
|
-
<li><strong>models:</strong> Product</li></ul><h2>Models</h2><h3>Product</h3><p>Simple product with basic attributes</p><h4>Attributes</h4><p><tr><td>Name</td><td>Type</td><td>Required</td><td>Unique</td><td>Description</td></tr>
|
|
85
|
-
|
|
86
|
-
<tr><td>id</td><td>UUID</td><td>✓</td></tr>
|
|
87
|
-
<tr><td>name</td><td>String</td><td>✓</td></tr>
|
|
88
|
-
<tr><td>summary</td><td>String</td></tr>
|
|
89
|
-
<tr><td>price</td><td>Money</td><td>✓</td></tr>
|
|
90
|
-
<tr><td>inStock</td><td>Boolean</td><td>Default: true</td></tr>
|
|
91
|
-
<tr><td>category</td><td>String</td><td>✓</td></tr>
|
|
92
|
-
<tr><td>contactEmail</td><td>Email</td></tr></p><h4>Behaviors</h4><h5>attachProfile</h5><p>Attach a profile to this model instance</p><p><strong>Parameters:</strong>
|
|
93
|
-
<li><code>profileName</code>: String (required)</li></ul><p><strong>Returns:</strong> Boolean</p><p><strong>Preconditions:</strong>
|
|
94
|
-
<li>Profile exists and is compatible with this model</li></ul><p><strong>Postconditions:</strong>
|
|
95
|
-
<li>Profile is attached</li>
|
|
96
|
-
<li>Profile attributes are available</li></ul><h5>detachProfile</h5><p>Detach a profile from this model instance</p><p><strong>Parameters:</strong>
|
|
97
|
-
<li><code>profileName</code>: String (required)</li></ul><p><strong>Returns:</strong> Boolean</p><p><strong>Preconditions:</strong>
|
|
98
|
-
<li>Profile is currently attached</li></ul><p><strong>Postconditions:</strong>
|
|
99
|
-
<li>Profile is detached</li>
|
|
100
|
-
<li>Profile attributes are no longer available</li></ul><h5>hasProfile</h5><p>Check if a profile is attached to this model instance</p><p><strong>Parameters:</strong>
|
|
101
|
-
<li><code>profileName</code>: String (required)</li></ul><p><strong>Returns:</strong> Boolean</p><p>---
|
|
102
|
-
</p>
|
|
103
|
-
</body>
|
|
104
|
-
</html>
|