You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configure an SDMX 3.0 registry that serves SDMX-JSON 2.0 and declares metadataAttributeUsages on its DSDs (e.g. IMF: IMF.STA:DSD_QNEA(7.0.0) has 25 - DOI, FULL_DESCRIPTION, AUTHOR, ...), with the PRESERVE_METADATA_ATTRIBUTE_USAGES structure fixture enabled.
Request that DSD from the proxy asking for SDMX-ML 2.1:
GET /statgpt/sdmx-proxy/api/v0/sdmx/3.0/structure/dataflow/IMF.STA/QNEA/7.0.0?references=datastructure
Accept: application/vnd.sdmx.structure+xml;version=2.1
The proxy fetches JSON 2.0 from the registry and converts it to XML 2.1.
Inspect the response and the proxy logs.
What is the expected behavior?
The metadataAttributeUsages should survive into the 2.1 output. SDMX-ML 2.1 has no MetadataAttributeUsage element, but the registry's own canonical 2.1 form folds each usage into the DSD AttributeList as a regular DataAttribute (IMF's /sdmx/2.1/datastructure/... returns 18 real + 25 folded = 43 <str:Attribute>, each with a <str:ConceptIdentity> derived from the MSD). The proxy's 2.1 output should match that - and produce no errors.
What do you see instead?
Two problems:
Data loss: the converted 2.1 XML contains only the 18 real DSD attributes; all 25 metadata-attribute usages are dropped (0 MetadataAttributeUsage, 0 folded attributes).
Noisy error per DSD: the JSON-only MetadataAttributeUsagePreserver runs even when the output is XML and tries to parse the XML as JSON, throwing (swallowed, logged at WARN) once per DSD:
WARN c.e.s.s.f.s.MetadataAttributeUsagePreserver: Failed to re-inject metadataAttributeUsages into converted JSON; returning unchanged output
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value ...
at com.epam.sdmxproxy.services.fixture.structure.MetadataAttributeUsagePreserver.inject(MetadataAttributeUsagePreserver.java:92)
at com.epam.sdmxproxy.services.adapter.AdapterRouterImpl.lambda$getStructuresConversion$0(AdapterRouterImpl.java:198)
Observed 17 occurrences in one capture window; 0 successful restores across 92 XML conversions.
Root cause:AdapterRouterImpl.getStructuresConversion runs the preserver whenever the marker is configured, without checking the output format. The preserver is JSON-output-only (inject() calls objectMapper.readTree(convertedJson)), so on XML output it always throws; and there is no mechanism that carries the usages into XML 2.1 at all.
MetadataAttributeUsage exists only in the SDMX 3.0 schema (sdmx-core-2.3.9/.../xsd/3_0/SDMXStructureDataStructure.xsd), absent from any 2.1 schema - hence the fold-to-DataAttribute representation.
JSON output is unaffected (the preserver works there); the defect is specific to the JSON 2.0 -> XML 2.1 structure path with the fixture enabled.
StatGPT SDMX Proxy version
0.1.0What steps will reproduce the bug?
metadataAttributeUsageson its DSDs (e.g. IMF:IMF.STA:DSD_QNEA(7.0.0)has 25 - DOI, FULL_DESCRIPTION, AUTHOR, ...), with thePRESERVE_METADATA_ATTRIBUTE_USAGESstructure fixture enabled.What is the expected behavior?
The
metadataAttributeUsagesshould survive into the 2.1 output. SDMX-ML 2.1 has noMetadataAttributeUsageelement, but the registry's own canonical 2.1 form folds each usage into the DSDAttributeListas a regularDataAttribute(IMF's/sdmx/2.1/datastructure/...returns 18 real + 25 folded = 43<str:Attribute>, each with a<str:ConceptIdentity>derived from the MSD). The proxy's 2.1 output should match that - and produce no errors.What do you see instead?
Two problems:
MetadataAttributeUsage, 0 folded attributes).MetadataAttributeUsagePreserverruns even when the output is XML and tries to parse the XML as JSON, throwing (swallowed, logged at WARN) once per DSD:Root cause:
AdapterRouterImpl.getStructuresConversionruns the preserver whenever the marker is configured, without checking the output format. The preserver is JSON-output-only (inject()callsobjectMapper.readTree(convertedJson)), so on XML output it always throws; and there is no mechanism that carries the usages into XML 2.1 at all.Additional information
docs/discussions/metadata-attribute-usages-2.1-xml.md. Design:docs/designs/032-structure-xml-21-metadata-attribute-usages/DESIGN.md. Fixed in PR fix: DSD metadataAttributeUsages dropped (and JsonParseException logged) on JSON 2.0 -> XML 2.1 structure conversion #87.MetadataAttributeUsageexists only in the SDMX 3.0 schema (sdmx-core-2.3.9/.../xsd/3_0/SDMXStructureDataStructure.xsd), absent from any 2.1 schema - hence the fold-to-DataAttributerepresentation.