|
1 | 1 | import type { Field } from '../../core/sdTypes.js'; |
2 | 2 | import type { ValueSetBindingInfo } from './validatorTypes.js'; |
| 3 | +import { stripVersionFromCanonicalUrl } from '../../core/utils.js'; |
3 | 4 | import { |
4 | 5 | buildNestedLoopCode, |
5 | 6 | emitSystemPresenceLeaf, |
@@ -139,7 +140,7 @@ function emitSystemPresenceFallback( |
139 | 140 | ): void { |
140 | 141 | const type = field.type || field.baseTypeCode; |
141 | 142 | if (type !== 'CodeableConcept' && type !== 'Coding' && type !== 'Quantity') return; |
142 | | - const vsUri = (field.binding!.uri || '').split('|')[0]; |
| 143 | + const vsUri = stripVersionFromCanonicalUrl(field.binding!.uri || ''); |
143 | 144 | const vsDisplayName = vsUri.split('/').pop() || vsUri; |
144 | 145 |
|
145 | 146 | if (isNested) { |
@@ -203,7 +204,7 @@ function emitSystemOnlyBinding( |
203 | 204 | const type = field.type || field.baseTypeCode; |
204 | 205 | if (type !== 'CodeableConcept' && type !== 'Coding' && type !== 'Quantity') return; |
205 | 206 |
|
206 | | - const sysVsUri = (field.binding!.uri || '').split('|')[0]; |
| 207 | + const sysVsUri = stripVersionFromCanonicalUrl(field.binding!.uri || ''); |
207 | 208 | const systemsLiteral = JSON.stringify(vsInfo.systems); |
208 | 209 | const vsDisplayName = vsInfo.displayName; |
209 | 210 |
|
@@ -286,7 +287,7 @@ function emitResolvedBinding( |
286 | 287 | const type = field.type || field.baseTypeCode; |
287 | 288 | const vsName = vsInfo.sanitizedName; |
288 | 289 | const vsDisplayName = vsInfo.displayName; |
289 | | - const vsUri = (field.binding!.uri || '').split('|')[0]; |
| 290 | + const vsUri = stripVersionFromCanonicalUrl(field.binding!.uri || ''); |
290 | 291 |
|
291 | 292 | if (isNested) { |
292 | 293 | const code = buildNestedLoopCode( |
|
0 commit comments