Repository navigation
fix(salesforce): give every exported field the dataType the API requires - #550
Conversation
Ossie makes a field's datatype optional and marks its role with nothing but the presence of the dimension object, so a document authored outside Salesforce can legitimately carry fields with no type at all. Export dropped the dataType for those, and for the portable types Time and Opaque that have no Salesforce equivalent, and the semantic model API answers a field without a dataType with HTTP 500 and no indication of which field is at fault. Fall back to the one type signal the document still carries, the field's role: a dimension exports as Text and a measurement as Number. The fallback sits alongside the existing displayCategory and label defaults, which run after custom_extensions are restored, so an exact Salesforce type and an explicit datatype both still win.
jbonofre
left a comment
There was a problem hiding this comment.
LGTM, thanks @RyutoYoda!
The role-based default fits the flow well: the putIfAbsent runs after the extension restore and applyOssieDatatype, so exact Salesforce values and explicit mappings still win.
One suggestion (possibly as follow-up): in FieldMappingHandler, a field with an explicit Ossie datatype that has no safe mapping (for example Time or Opaque) and no Salesforce extension now falls through to the role default. It becomes Text, or Number for a measurement, so a Time measurement ships as Number. Before this PR the dataType was omitted and warning said so.
Could we either name the chosen dataType in the warning, or apply the default only when datatype is null?
|
Thanks — taking it as a follow-up, as you suggested. The warning will name the chosen dataType. On the second option: defaulting only when |
Summary
The semantic model API answers a field with no
dataTypewith HTTP 500 and noindication of which field is at fault:
Ossie makes
datatypeoptional and marks a field's role with nothing but thepresence of
dimension, so a document authored outside Salesforce legitimatelycarries fields with no type at all. Export dropped the
dataTypefor those, andfor
TimeandOpaque, which have no Salesforce equivalent.Fall back to the one type signal the document still carries, the field's role: a
dimension exports as
Textand a measurement asNumber. It sits with theexisting
displayCategoryandlabeldefaults, which run aftercustom_extensionsare restored, so an exact Salesforce type and an explicitdatatypeboth still win.Export is not schema-validated, so this surfaces only on POST, as
dataspaceanddataObjectTypedid in #526.Verification
mvn -B clean verify: 333 tests, 0 failures.mainis 331, so this adds twoand breaks nothing.
apache-rat:checkclean.dataTypecango missing: a dimension and a measurement declaring no
datatype, aTimedimension and an
Opaquemeasurement with no Salesforce mapping, and acalculated dimension declaring no
datatype. Onmainthe POST is rejected500with the error above and nothing is created. On this branch the samemodel is accepted
201, and the org reads the five fields back asText,Text,Number,NumberandText.Related Issues
No existing issue covers this.
Checklist
Sections this change does not touch (Specification, Ontology, Validation,
Examples) are omitted rather than left unchecked.
Converters
Documentation
Time/OpaquechangeTests
Compliance