Skip to content

Commit

Permalink
feat(map): Resolve namespace resolution for Map Types (#9)
Browse files Browse the repository at this point in the history
* feat(map): resolves namespace for Map Type

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* chore(dep): add concerto-core dep

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* feat(map): extend test coverage

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* chore(dep): add node types

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* feat(map): define ns recursively

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* feat(*): add scalar support

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* feat(map): use latest concerto-core

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* feat(map): test coverage for resolving imports on maps

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* feat(map): test refactor

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* chore(*): no circular dependency

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

* feat(map): resolve decorators on MapDeclarations and Scalars

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>

---------

Signed-off-by: Jonathan Casey <jonathan.casey@docusign.com>
  • Loading branch information
jonathan-casey authored Oct 20, 2023
1 parent c240b23 commit 5ead0b9
Show file tree
Hide file tree
Showing 8 changed files with 1,897 additions and 13 deletions.
27 changes: 26 additions & 1 deletion lib/metamodelutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function createNameTable(priorModels, metaModel) {
'Asset': concertoNs,
'Participant': concertoNs,
'Transaction ': concertoNs,
'Event': concertoNs,
'Event': concertoNs
};

// First list the imported names in order (overriding as we go along)
Expand Down Expand Up @@ -147,6 +147,11 @@ function resolveTypeNames(metaModel, table) {
});
}
break;
case `${MetaModelNamespace}.MapDeclaration`: {
resolveTypeNames(metaModel.key, table);
resolveTypeNames(metaModel.value, table);
}
break;
case `${MetaModelNamespace}.EnumProperty`:
case `${MetaModelNamespace}.ObjectProperty`:
case `${MetaModelNamespace}.RelationshipProperty`: {
Expand All @@ -168,6 +173,26 @@ function resolveTypeNames(metaModel, table) {
metaModel.type.namespace = resolveName(name, table);
}
break;
case `${MetaModelNamespace}.ObjectMapKeyType`:
case `${MetaModelNamespace}.ObjectMapValueType`: {
metaModel.type.namespace = resolveName(metaModel.type.name, table);
(metaModel.decorators || []).forEach((decorator) => {
resolveTypeNames(decorator, table);
});
}
break;
case `${MetaModelNamespace}.StringScalar`:
case `${MetaModelNamespace}.BooleanScalar`:
case `${MetaModelNamespace}.DateTimeScalar`:
case `${MetaModelNamespace}.DoubleScalar`:
case `${MetaModelNamespace}.LongScalar`:
case `${MetaModelNamespace}.IntegerScalar`: {
metaModel.namespace = resolveName(metaModel.name, table);
(metaModel.decorators || []).forEach((decorator) => {
resolveTypeNames(decorator, table);
});
}
break;
}
return metaModel;
}
Expand Down
Loading

0 comments on commit 5ead0b9

Please sign in to comment.