Skip to content

Conversation

@hussein-saad
Copy link

@hussein-saad hussein-saad commented Mar 13, 2025

Closes #55

Changes

New Command Addition:

  • Added a new validate-ast command to the CLI, which validates a JSON syntax tree against the Concerto metamodel.

Error Handling Improvements:

  • Improved error handling in the print method to catch and report JSON parsing errors and invalid AST structures. (lib/commands.js)
  • Added comprehensive error messages for various validation failures in the validateAST method. (lib/commands.js)

Validation Enhancements:

  • Introduced a new validateAST method in the Commands class to validate a Concerto JSON AST. This method checks for the correct structure, required properties. (lib/commands.js)

Test Coverage Expansion:

  • Added tests for the new validateAST method to cover various scenarios, including valid and invalid models, missing properties, and error handling. (test/cli.js)
  • Enhanced existing tests to handle invalid JSON content, file not found errors, and invalid AST validation. (test/cli.js)

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

…amodel and enhance print function with AST validation

Add validateAST method to validate Concerto metamodel JSON structures
Enhance print function to validate AST structure before converting to CTO
Provide detailed error messages for invalid AST structur

Signed-off-by: Hussein Saad <hussein.saad2021@gmail.com>
@hussein-saad
Copy link
Author

hi @DianaLease, could you please review this PR?

@DianaLease DianaLease requested review from a team, dselman and mttrbrts March 18, 2025 22:22
@DianaLease
Copy link
Member

@dselman @mttrbrts Could you please take a look at this one? thanks!

Copy link
Member

@mttrbrts mttrbrts left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Let's reuse the validation logic that already exists in the MetamodelUtil module, rather than redefining it partially here.

Signed-off-by: Hussein Saad <hussein.saad2021@gmail.com>
@hussein-saad hussein-saad requested a review from mttrbrts April 2, 2025 23:22
Copy link
Member

@mttrbrts mttrbrts left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. Just a few small comments from me.

… AST validation

Signed-off-by: Hussein Saad <hussein.saad2021@gmail.com>
Signed-off-by: Hussein Saad <hussein.saad2021@gmail.com>
Signed-off-by: Hussein Saad <hussein.saad2021@gmail.com>
@hussein-saad hussein-saad requested a review from mttrbrts April 5, 2025 23:56
@hussein-saad
Copy link
Author

hey @mttrbrts, could you take a look at the changes when you have time?

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.

Add validateAST command and/or validate on print

3 participants