@@ -379,7 +379,7 @@ const mxFunction = (base) => {
379379 } catch ( _ ) {
380380 return undefined
381381 }
382-
382+
383383 }
384384
385385 /**
@@ -493,25 +493,27 @@ const mxFunction = (base) => {
493493 if ( ! shape || ! range ) {
494494 return undefined ;
495495 }
496- // let name;
497- if (
498- this . _hasType ( shape , this . ns . aml . vocabularies . apiContract . Parameter )
499- ) {
500- return /** @type string */ ( this . _getValue (
501- range ,
502- this . ns . aml . vocabularies . core . name
503- ) ) ;
496+
497+ const coreName = this . ns . aml . vocabularies . core . name ;
498+ const shaclName = this . ns . w3 . shacl . name ;
499+ const parameterType = this . ns . aml . vocabularies . apiContract . Parameter ;
500+ const nodeShapeType = this . ns . w3 . shacl . NodeShape ;
501+
502+ // Check if the shape is of type Parameter
503+ if ( this . _hasType ( shape , parameterType ) ) {
504+ return /** @type string */ ( this . _getValue ( range , coreName ) ) ;
504505 }
505- if ( this . _hasType ( range , this . ns . w3 . shacl . NodeShape ) ) {
506- return /** @type string */ ( this . _getValue (
507- shape ,
508- this . ns . w3 . shacl . name
509- ) ) ;
510- }
511- return /** @type string */ ( this . _getValue (
512- range ,
513- this . ns . aml . vocabularies . core . name
514- ) ) ;
506+
507+ // Check if the range is of type NodeShape
508+ if ( this . _hasType ( range , nodeShapeType ) ) {
509+ return (
510+ /** @type string */ ( this . _getValue ( range , coreName ) ) ||
511+ /** @type string */ ( this . _getValue ( shape , shaclName ) )
512+ ) ;
513+ }
514+
515+ // Default case: return the core name from the range
516+ return /** @type string */ ( this . _getValue ( range , coreName ) ) ;
515517 }
516518
517519 _computeHasMediaType ( mediaType ) {
0 commit comments