Skip to content

fix(salesforce): emit the dataspace and dataObjectType the API requires - #526

Merged
jbonofre merged 1 commit into
apache:mainfrom
RyutoYoda:fix/salesforce-required-api-fields
Oct 7, 2026
Merged

jbonofre merged 1 commit into
apache:mainfrom
RyutoYoda:fix/salesforce-required-api-fields

Conversation

@RyutoYoda

Copy link
Copy Markdown
Contributor

Summary

The semantic model API rejects a payload that omits the model's dataspace or a
data object's dataObjectType, and both reached the export only through
SALESFORCE custom extensions. A model that came back out of Salesforce carries
them; one authored anywhere else does not, so a document handed over by another
converter exports JSON the API refuses:

POST .../ssot/semantic/models
400  The semantic model is missing a mandatory dataspace value
500  element cannot be mapped to a null key   (once the dataspace alone is supplied)

Both now default alongside the existing label and tableType defaults, which
run after custom extensions are restored, so a restored value still wins.

The reference type is read off the data object name: Data Cloud suffixes it with
the kind of object it is, so datasets[].source already carries the answer, and
the API enforces the pairing.

dataObjectName dataObjectType Live result
…__dll Dlo 201
…__dll Dmo 400, not a DMO
…__dlm Dmo 201
…__dlm Dlo 400, not a DLO

A name with neither suffix came from outside Data Cloud and lands in a data lake
object once ingested, so Dlo is the default.

The published schema's dataObjectType enum is stale (Dlo, Query) where
v67.0 takes Dlo and Dmo and rejects Query. Export is not schema-validated,
so this only bites on import, where a DMO-backed model is already rejected today.
The README notes it; it is a separate problem from this one.

Verification

  • mvn -B -DrequireSalesforceSchema=true clean verify: 296 tests, 0 failures,
    0 errors, 0 skipped. Green on the CI profile too, with the 15 pre-existing
    schema-gated skips.
  • Each default fails a test when the main-code change is reverted; a third test
    guards that a restored custom extension still wins over the suffix.
  • End-to-end against a live org, with a model authored outside Salesforce: on
    main the export POSTs 400, on this branch the same export POSTs 201 and
    /validate returns isValid: true. The test model was deleted afterwards.
  • A model that does carry SALESFORCE custom extensions exports byte-identical
    to main, and export → import → export is stable.

Related Issues

No existing issue or PR covers this. Same shape as #512 and #514: a default that
sits after the custom-extension restore.

Checklist

Sections this change does not touch (Specification, Ontology, Validation,
Examples) are omitted rather than left unchecked.

Converters

  • Converter logic updated
  • Tests live under the converter's test directory

Documentation

  • converters/salesforce/README.md documents both defaults and the suffix rule

Tests

  • All existing tests pass: 296 passed, 0 skipped locally; green on the CI profile
  • New functionality is covered by tests, and they fail without the fix

Compliance

  • ASF license headers present (no new files added)
  • No third-party dependencies added

The semantic model API rejects a payload that omits the model's dataspace
or a data object's reference type, but both reached the output only by way
of SALESFORCE custom_extensions. A model round-tripped out of Salesforce
carried them; one authored anywhere else did not, so a document arriving
from another converter exported JSON the API refuses: 400 "missing a
mandatory dataspace value", and 500 once the dataspace alone is supplied.

Both are now defaulted alongside the existing label and tableType defaults,
which run after custom_extensions are restored, so an explicit value still
wins. The reference type is read off the data object name, which Data Cloud
suffixes with the kind of object it is: __dlm is a data model object and
anything else a data lake object. The README documents both defaults.

@jbonofre jbonofre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

applyDefaults runs after restoreCustomExtensionsAtLevel and uses putIfAbsent, so a restored dataObjectType or dataspace still takes precedence over the default, and the new test covers that. A missing dataObjectName falls back to Dlo safely.

Nit: the __dlm suffix check is case-sensitive, so something like Orders__DLM would be classified as Dlo. Data Cloud suffixes are lowercase, so I don't think it matters in practice.

@jbonofre
jbonofre merged commit bbb8e40 into apache:main Oct 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants