Repository navigation
ADR-057: Canonical Schema (optional field/object mapping extension) - #676
Conversation
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
✅ Deploy Preview for friggframework-org canceled.
|
| extensions: { | ||
| webhooks: require('./extensions/webhooks'), | ||
| mapping: { | ||
| schemas: { business: require('./mappings/business.yaml') }, // invoice Line[] → InvoiceLine + Product (one-to-many) |
There was a problem hiding this comment.
The example calls require('./mappings/business.yaml'). Node's require cannot load .yaml files without a custom loader, so it throws a SyntaxError at module load. The ADR defines no loader or build step for this, so a module copying the pattern would fail to import.
Fix by using an explicit loader, for example:
schemas: { business: loadYaml(path.join(__dirname, 'mappings/business.yaml')) }Alternatively, state in the ADR that the framework resolves mapping file paths.
| schemas: { business: require('./mappings/business.yaml') }, // invoice Line[] → InvoiceLine + Product (one-to-many) | |
| schemas: { business: loadYaml(path.join(__dirname, 'mappings/business.yaml')) }, // invoice Line[] → InvoiceLine + Product (one-to-many) | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Fixed in 3b02d40: the example now loads the mapping with an explicit loadYaml(path.join(__dirname, 'mappings/business.yaml')) instead of require on a .yaml file.
There was a problem hiding this comment.
Follow-up in a12b242: the example is now a plain JS module. mappings/business.js exports an object and is loaded with a normal require. YAML and the loadYaml helper are gone. Schemas and mappings are now plain CommonJS objects validated against new JSON Schemas in @friggframework/schemas.
| Invoice: { filter: { source: 'hubspot.deal', where: { dealstage: '{{config.invoiceStage}}' } } }, | ||
| }, | ||
| }, | ||
| capabilities: { | ||
| 'crm.customer.sync.bidir': { | ||
| surface: 'sync', | ||
| flows: [ | ||
| { from: 'hubspot', to: 'quickbooks', object: 'Customer', trigger: 'webhook' }, | ||
| { from: 'quickbooks', to: 'hubspot', object: 'Customer', trigger: 'webhook' }, | ||
| ], | ||
| }, | ||
| 'billing.invoice.create': { | ||
| surface: 'sync', | ||
| flows: [{ from: 'hubspot', to: 'quickbooks', object: 'Invoice', source: 'Deal', conflict: 'createOnly' }], |
There was a problem hiding this comment.
The worked example is internally inconsistent and would fail the Test Bench check this ADR describes.
- The integration declares
Invoice: { filter: { source: 'hubspot.deal', ... } }and abilling.invoice.createflow withobject: 'Invoice', source: 'Deal'. - The HubSpot mapping (lines 80-93) only maps
contactandcompany. There is nodeal→Invoicemapping. - The QuickBooks mapping does not show an
Invoicemapping either. - Line 170 says Test Bench must fail when a rule or flow references an object absent from the resolved mappings. As written, the example would fail.
sourceis spelledhubspot.dealin the rule andDealin the flow.conflict: 'createOnly'uses an ADR-045 trait name as a conflict strategy. Line 179 says such traits should not be redeclared, and line 124 useslastWriteWinsfor conflicts.
Fix: add a deal → Invoice mapping to the HubSpot example, use one consistent source spelling, and express createOnly through traits rather than conflict.
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
…ork/schemas; drop YAML
|
|
🚀 PR was released in |
|
🚀 PR was released in |
1 similar comment
|
🚀 PR was released in |



Adds
docs/architecture-decisions/057-canonical-schema.md(Proposed).appDefinition.canonicalSchemas.extensions.mapping, ADR-019). Mappings are declarative, conditional and one-to-many.business@^2) are checked by Test Bench.flowson ADR-020 capabilities. Direction, copy and fit checks are derived from them.