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(class): throw error when class is extending itself #764

Conversation

stefanblaginov
Copy link
Contributor

@stefanblaginov stefanblaginov commented Nov 22, 2023

Closes #750

Changes

Adds validation for cases where a class (an asset, event, concept, participant or transaction) is extending itself. The validations are performed when:

  • parse-ing CTO to JSON AST.
  • print-ing JSON AST to CTO.
  • Loading JSON AST into the model manager.

The following will be caught by the anti-self-extension validation:

concept Self_Extending extends Self_Extending {}
{
  "$class": "concerto.metamodel@1.0.0.ConceptDeclaration",
  "name": "Self_Extending",
  "isAbstract": false,
  "properties": [],
  "superType": {
    "$class": "concerto.metamodel@1.0.0.TypeIdentified",
    "name": "Self_Extending"
  }
}

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

@stefanblaginov stefanblaginov self-assigned this Nov 27, 2023
Stefan Blaginov added 3 commits November 27, 2023 18:40
Signed-off-by: Stefan Blaginov <stefanblaginov@gmail.com>
…amodel form

Signed-off-by: Stefan Blaginov <stefanblaginov@gmail.com>
Signed-off-by: Stefan Blaginov <stefanblaginov@gmail.com>
@stefanblaginov stefanblaginov force-pushed the stefanblaginov/fix-self-extending branch from e8762f6 to f2d9491 Compare November 27, 2023 18:41
@stefanblaginov stefanblaginov changed the title Stefanblaginov/fix self extending fix(parser): throw error when class is extending itself Nov 27, 2023
@stefanblaginov stefanblaginov changed the title fix(parser): throw error when class is extending itself fix(class): throw error when class is extending itself Nov 27, 2023
Signed-off-by: Stefan Blaginov <stefanblaginov@gmail.com>
@stefanblaginov stefanblaginov force-pushed the stefanblaginov/fix-self-extending branch from f2d9491 to 3f58d4a Compare November 27, 2023 18:42
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.

Should not be able to create a concept whose super type is itself
1 participant