Skip to content

Commit b57d43d

Browse files
akoclaude
andcommitted
docs(proposal): add EXPORT CONTRACT for published service contract generation
Add contract generation section to Phase 2, mirroring Studio Pro's ability to download/generate contracts for published services: - Published REST → OpenAPI 3.0 JSON - Published OData → $metadata XML (+ optional GraphQL schema) - Business Event Service → AsyncAPI YAML - EXPORT CONTRACT syntax with FORMAT and TO options - Auto-detect format based on service type when FORMAT omitted Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 36777ba commit b57d43d

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

docs/11-proposals/integration-pane-proposal.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,50 @@ SQL mydb SHOW TABLES;
409409
SQL mydb DESCRIBE TABLE orders;
410410
```
411411

412+
### Contract Generation for Published Services
413+
414+
Studio Pro can generate/download contracts for published services (OpenAPI for REST, `$metadata` for OData, GraphQL schema for OData, AsyncAPI for business events). We need the same in MDL so users can export a current contract for services defined in their project.
415+
416+
#### Published REST → OpenAPI
417+
```sql
418+
-- Generate OpenAPI 3.0 JSON from a published REST service definition
419+
EXPORT CONTRACT FROM MyModule.CustomerAPI FORMAT openapi;
420+
EXPORT CONTRACT FROM MyModule.CustomerAPI FORMAT openapi TO '/path/to/openapi.json';
421+
```
422+
423+
Generate by mapping published REST resources and operations to OpenAPI paths, methods, and parameters. Include microflow return types as response schemas where inferrable.
424+
425+
#### Published OData → `$metadata` / GraphQL
426+
```sql
427+
-- Generate OData $metadata XML from a published OData service definition
428+
EXPORT CONTRACT FROM MyModule.ProductAPI FORMAT odata;
429+
EXPORT CONTRACT FROM MyModule.ProductAPI FORMAT odata TO '/path/to/metadata.xml';
430+
431+
-- Generate GraphQL schema from a published OData service (optional, OData4 only)
432+
EXPORT CONTRACT FROM MyModule.ProductAPI FORMAT graphql;
433+
```
434+
435+
Generate by mapping published entity types, entity sets, exposed members, and CRUD modes to EDMX/CSDL. The GraphQL variant maps entity sets to queries and CUD modes to mutations.
436+
437+
#### Business Event Service → AsyncAPI
438+
```sql
439+
-- Generate AsyncAPI YAML from a business event service definition
440+
EXPORT CONTRACT FROM MyModule.OrderEvents FORMAT asyncapi;
441+
EXPORT CONTRACT FROM MyModule.OrderEvents FORMAT asyncapi TO '/path/to/asyncapi.yaml';
442+
```
443+
444+
Generate by mapping channels, messages, and attributes from the structured `Definition` to AsyncAPI 2.x format with CloudEvents headers.
445+
446+
#### Default Behavior
447+
```sql
448+
-- Without FORMAT, auto-detect based on service type
449+
EXPORT CONTRACT FROM MyModule.CustomerAPI; -- REST → openapi
450+
EXPORT CONTRACT FROM MyModule.ProductAPI; -- OData → odata
451+
EXPORT CONTRACT FROM MyModule.OrderEvents; -- Business Event → asyncapi
452+
```
453+
454+
When no `TO` path is given, output the contract to stdout (useful for piping or inspection).
455+
412456
---
413457

414458
## Phase 3: SOAP Web Services (Future)

0 commit comments

Comments
 (0)