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

fix(aliasing): added new property to the typeIdentifier concept for resolved name #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sanketshevkar
Copy link
Member

Closes accordproject/concerto#972

Added to new resolvedName property to TypeIdenifier. This is to preserve the aliased name property which will have the local name for the aliased type. resolvedName will contain the origonal type name.

With the current implementation the value of the name property is different for a normal ast (local name) vs a resolved ast (original type name). This can be very confusing.

Related Issues

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

@sanketshevkar sanketshevkar marked this pull request as draft January 9, 2025 15:02
@coveralls
Copy link

Pull Request Test Coverage Report for Build 12692547368

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.09%) to 95.918%

Totals Coverage Status
Change from base Build 12138117157: 0.09%
Covered Lines: 89
Relevant Lines: 89

💛 - Coveralls

@sanketshevkar sanketshevkar marked this pull request as ready for review January 13, 2025 09:07
@@ -19,6 +19,5 @@
/**
* The metamodel itself, as a CTO string
*/
const metaModelCto = "/*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@DotNetNamespace(\"AccordProject.Concerto.Metamodel\")\nnamespace [email protected]\n\nconcept Position {\n o Integer line\n o Integer column\n o Integer offset\n}\n\nconcept Range {\n o Position start\n o Position end\n o String source optional\n}\n\nconcept TypeIdentifier {\n o String name\n o String namespace optional\n}\n\nabstract concept DecoratorLiteral {\n o Range location optional\n}\n\nconcept DecoratorString extends DecoratorLiteral {\n o String value\n}\n\nconcept DecoratorNumber extends DecoratorLiteral {\n o Double value\n}\n\nconcept DecoratorBoolean extends DecoratorLiteral {\n o Boolean value\n}\n\nconcept DecoratorTypeReference extends DecoratorLiteral {\n o TypeIdentifier type\n o Boolean isArray default=false\n}\n\nconcept Decorator {\n o String name\n o DecoratorLiteral[] arguments optional\n o Range location optional\n}\n\nconcept Identified {\n}\n\nconcept IdentifiedBy extends Identified {\n o String name\n}\n\nabstract concept Declaration {\n o String name regex=/^(\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4})(?:\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4}|\\p{Mn}|\\p{Mc}|\\p{Nd}|\\p{Pc}|\\u200C|\\u200D)*$/u\n o Decorator[] decorators optional\n o Range location optional\n}\n\nabstract concept MapKeyType {\n o Decorator[] decorators optional\n o Range location optional\n}\n\nabstract concept MapValueType {\n o Decorator[] decorators optional\n o Range location optional\n}\n\nconcept MapDeclaration extends Declaration {\n o MapKeyType key\n o MapValueType value\n}\n\nconcept StringMapKeyType extends MapKeyType {}\nconcept DateTimeMapKeyType extends MapKeyType {}\n\nconcept ObjectMapKeyType extends MapKeyType {\n o TypeIdentifier type\n}\n\nconcept BooleanMapValueType extends MapValueType {}\nconcept DateTimeMapValueType extends MapValueType {}\nconcept StringMapValueType extends MapValueType {}\nconcept IntegerMapValueType extends MapValueType {}\nconcept LongMapValueType extends MapValueType {}\nconcept DoubleMapValueType extends MapValueType {}\n\nconcept ObjectMapValueType extends MapValueType {\n o TypeIdentifier type\n}\n\nconcept RelationshipMapValueType extends MapValueType {\n o TypeIdentifier type\n}\n\nconcept EnumDeclaration extends Declaration {\n o EnumProperty[] properties\n}\n\nconcept EnumProperty {\n o String name regex=/^(\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4})(?:\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4}|\\p{Mn}|\\p{Mc}|\\p{Nd}|\\p{Pc}|\\u200C|\\u200D)*$/u\n o Decorator[] decorators optional\n o Range location optional\n}\n\nconcept ConceptDeclaration extends Declaration {\n o Boolean isAbstract default=false\n o Identified identified optional\n o TypeIdentifier superType optional\n o Property[] properties\n}\n\nconcept AssetDeclaration extends ConceptDeclaration {\n}\n\nconcept ParticipantDeclaration extends ConceptDeclaration {\n}\n\nconcept TransactionDeclaration extends ConceptDeclaration {\n}\n\nconcept EventDeclaration extends ConceptDeclaration {\n}\n\nabstract concept Property {\n o String name regex=/^(\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4})(?:\\p{Lu}|\\p{Ll}|\\p{Lt}|\\p{Lm}|\\p{Lo}|\\p{Nl}|\\$|_|\\\\u[0-9A-Fa-f]{4}|\\p{Mn}|\\p{Mc}|\\p{Nd}|\\p{Pc}|\\u200C|\\u200D)*$/u\n o Boolean isArray default=false\n o Boolean isOptional default=false\n o Decorator[] decorators optional\n o Range location optional\n}\n\nconcept RelationshipProperty extends Property {\n o TypeIdentifier type\n}\n\nconcept ObjectProperty extends Property {\n o String defaultValue optional\n o TypeIdentifier type\n}\n\nconcept BooleanProperty extends Property {\n o Boolean defaultValue optional\n}\n\nconcept DateTimeProperty extends Property {\n}\n\nconcept StringProperty extends Property {\n o String defaultValue optional\n o StringRegexValidator validator optional\n o StringLengthValidator lengthValidator optional\n}\n\nconcept StringRegexValidator {\n o String pattern\n o String flags\n}\n\nconcept StringLengthValidator {\n o Integer minLength optional\n o Integer maxLength optional\n}\n\nconcept DoubleProperty extends Property {\n o Double defaultValue optional\n o DoubleDomainValidator validator optional\n}\n\nconcept DoubleDomainValidator {\n o Double lower optional\n o Double upper optional\n}\n\nconcept IntegerProperty extends Property {\n o Integer defaultValue optional\n o IntegerDomainValidator validator optional\n}\n\nconcept IntegerDomainValidator {\n o Integer lower optional\n o Integer upper optional\n}\n\nconcept LongProperty extends Property {\n o Long defaultValue optional\n o LongDomainValidator validator optional\n}\n\nconcept LongDomainValidator {\n o Long lower optional\n o Long upper optional\n}\n\nconcept AliasedType{\n o String name\n o String aliasedName\n}\nabstract concept Import {\n o String namespace\n o String uri optional\n}\n\nconcept ImportAll extends Import {\n}\n\nconcept ImportType extends Import {\n o String name\n}\n\nconcept ImportTypes extends Import {\n o String[] types\n o AliasedType[] aliasedTypes optional\n}\n\nconcept Model {\n o String namespace\n o String sourceUri optional\n o String concertoVersion optional\n o Import[] imports optional\n o Declaration[] declarations optional\n o Decorator[] decorators optional\n}\n\nconcept Models {\n o Model[] models\n}\n\nabstract concept ScalarDeclaration extends Declaration {\n}\n\nconcept BooleanScalar extends ScalarDeclaration {\n o Boolean defaultValue optional\n}\n\nconcept IntegerScalar extends ScalarDeclaration {\n o Integer defaultValue optional\n o IntegerDomainValidator validator optional\n}\n\nconcept LongScalar extends ScalarDeclaration {\n o Long defaultValue optional\n o LongDomainValidator validator optional\n}\n\nconcept DoubleScalar extends ScalarDeclaration {\n o Double defaultValue optional\n o DoubleDomainValidator validator optional\n}\n\nconcept StringScalar extends ScalarDeclaration {\n o String defaultValue optional\n o StringRegexValidator validator optional\n o StringLengthValidator lengthValidator optional\n}\n\nconcept DateTimeScalar extends ScalarDeclaration {\n o String defaultValue optional\n}\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks shortened, I would have expected to become longer.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think its the regex. In the github diff viewer, older code is taking more lines than the new code.

On my vscode diff viewer things seemed fine.

Copy link
Contributor

@ekarademir ekarademir left a comment

Choose a reason for hiding this comment

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

@sanketshevkar How would this close #972, wouldn't you also need to update the printer? If it closes, could you add tests to prove that the problem is solved?

@sanketshevkar
Copy link
Member Author

sanketshevkar commented Jan 15, 2025

@ekarademir printer I believe only cares about the local name for a cto file and already uses the name property to print back the cto again.

Yes tests needs to be added. I'll add them in this PR.

@ekarademir
Copy link
Contributor

Yes tests needs to be added. I'll add them in this PR.

Could you then update the description, so that it doesn't close the ticket?

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.

APIs from concerto-core are breaking for aliased models whose types are resolved.
4 participants