Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(map): Support Map Key Type Imports #739

Merged
merged 3 commits into from
Oct 19, 2023

Conversation

jonathan-casey
Copy link
Member

Description

Adds logic to support declaration of Map Key Type as an Imported Type. Additional test cases also added.

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

@jonathan-casey jonathan-casey requested a review from a team October 19, 2023 14:46
@jonathan-casey jonathan-casey merged commit bfd514d into main Oct 19, 2023
11 checks passed
@jonathan-casey jonathan-casey deleted the jonathan/map_key_import_patch branch October 19, 2023 17:35
@@ -331,6 +338,21 @@ class ModelUtil {
`${MetaModelNamespace}.ObjectMapValueType`
].includes(value.$class);
}

/**
* Returns the corresponding ClassDeclaration representation of the Map Type
Copy link
Contributor

@dselman dselman Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the jsdoc - this is not map specific.

Not sure we need this function. ModelFile.getType takes a short type name and returns the FQN, taking care of primitive, imported types and reports errors.

The docs for this function are not clear in whether type is a short name or FQN and what happens with primitives, and what happens if the type does not exist (null/undefined return or throws an exception).

In general in Concerto we use "from biggest to smallest" when we order function args, so this would be (model, type).

If you decide we need this function, then the implementation could be:

// decl will be null for primitive types ... or throw exception?

const decl = !ModelUtil.isPrimitiveType((shortName) ? modelFile.getModelManager().getType(modelFile.getType(shortName)) : null;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants