Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions runner.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Parser } from '@accordproject/concerto-cto';
import { ModelFile, ModelManager } from '@accordproject/concerto-core';

export default {
parser: Parser,
modelFile: ModelFile,
modelManager: new ModelManager({ enableMapType: true }),
};
28 changes: 28 additions & 0 deletions semantic/features/concepts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,34 @@ Feature: Semantic Validation for CTO Class Declarations
When I validate the models
Then no error should be thrown

Scenario: Unique property names across inheritance
Given I load the following models:
| model_file | alias |
| concepts/models/CLASS_DECLARATION_009/class_declaration_009_circular_inheritance.cto | main |
When I validate the models
Then an error should be thrown with message "Maximum call stack size exceeded"

Scenario: Unique property names across inheritance
Given I load the following models:
| model_file | alias |
| concepts/models/CLASS_DECLARATION_009/class_declaration_009_valid_inheritance.cto | main |
When I validate the models
Then no error should be thrown

Scenario: Unique property names across inheritance
Given I load the following models:
| model_file | alias |
| concepts/models/CLASS_DECLARATION_010/class_declaration_010_duplicate_property_from_super.cto | main |
When I validate the models
Then an error should be thrown with message "has more than one field"

Scenario: Unique property names across inheritance
Given I load the following models:
| model_file | alias |
| concepts/models/CLASS_DECLARATION_010/class_declaration_010_unique_property_from_super.cto | main |
When I validate the models
Then no error should be thrown

Scenario: Duplicate declarations should throw
Given I load the following models:
| model_file | alias |
Expand Down
28 changes: 21 additions & 7 deletions semantic/features/namespaces.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,30 @@ Feature: Semantic Validation of CTO Namespace Imports
@skip
Scenario: Invalid duplicate namespace imports should throw an error
Given I load the following models:
| model_file | alias |
| namespaces/models/MODEL_FILE_002/importedTypes.cto | imported |
| namespaces/models/MODEL_FILE_002/model_file_002_duplicate_namespace_imports.cto | main |
| model_file | alias |
| namespaces/models/MODEL_FILE_002/importedTypes.cto | imported |
| namespaces/models/MODEL_FILE_002/model_file_002_duplicate_namespace_imports.cto | main |
When I validate the models
Then an error should be thrown with message "Namespace org.external.types is already defined"

Scenario: Valid unique namespace imports should pass
Given I load the following models:
| model_file | alias |
| namespaces/models/MODEL_FILE_002/importedTypes.cto | imported |
| namespaces/models/MODEL_FILE_002/model_file_002_unique_namespace_imports.cto | main |
| model_file | alias |
| namespaces/models/MODEL_FILE_002/importedTypes.cto | imported |
| namespaces/models/MODEL_FILE_002/model_file_002_unique_namespace_imports.cto | main |
When I validate the models
Then no error should be thrown
Then no error should be thrown

Scenario: Invalid self-import should throw MODEL_FILE_004 error
Given I load the following models:
| model_file | alias |
| namespaces/models/MODEL_FILE_003/model_file_003_self_import.cto | main |
When I validate the models
Then an error should be thrown with message "Namespace is not defined for type"

Scenario: Valid model without self-import should pass
Given I load the following models:
| model_file | alias |
| namespaces/models/MODEL_FILE_003/model_file_003_valid_import.cto | main |
When I validate the models
Then no error should be thrown
13 changes: 13 additions & 0 deletions semantic/features/scalars.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ Feature: Semantic Validation of CTO Scalars specification
| scalars/models/NUMBER_VALIDATOR_002/number_validator_002_lower_greater_than_upper.cto |main|
Then an error should be thrown with message "/Lower bound must be less than or equal to upper bound/"


Scenario: Invalid floating point range on Integer property should throw an error
Given I load the following models:
| model_file | alias |
| scalars/models/NUMBER_VALIDATOR_003/number_validator_003_invalid_range_type.cto | main |
Then an error should be thrown with message 'Expected ","'

Scenario: Valid integer range on Integer property should pass validation
Given I load the following models:
| model_file | alias |
| scalars/models/NUMBER_VALIDATOR_003/number_validator_003_valid_range_type.cto | main |
Then no error should be thrown

Scenario: should pass for valid string length bounds
Given I load the following models:
| model_file |alias|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Semantic.Support.CSharp")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ab1c0b591c54f581969d654d8f4aed6e3c76c4c5")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+63a012d9040a0114719eb56b8d735e07fff7bb4a")]
[assembly: System.Reflection.AssemblyProductAttribute("Semantic.Support.CSharp")]
[assembly: System.Reflection.AssemblyTitleAttribute("Semantic.Support.CSharp")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e78ef0e113f61fa9a797fd34e6fd0045449697fdb637ea1b17d1870a1d3f0d10
ac751e616cdb4178e8e1b0c3c1233dc4b2b6a691fe113800adc728d7d8146b29
1 change: 1 addition & 0 deletions semantic/features/support/Javascript/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Given('I load the following models:', function (dataTable) {
}
});


When('I validate the models', function () {
try {
this.modelManager.validateModelFiles();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid
namespace org.concerto.concepts.cd001.invalid@1.0.0

concept SampleConcept {
o String name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid
namespace org.concerto.concepts.cd001.valid@1.0.0

concept SampleConcept {
o String name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid
namespace org.concerto.concepts.cd002.invalid@1.0.0

concept SampleConcept {
o Integer $class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid
namespace org.concerto.concepts.cd002.valid@1.0.0

concept SampleConcept {
o String name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace org.example.invalid
namespace org.concerto.concepts.cd003.invalid@1.0.0

concept SampleConcept {
concept SampleConceptA {
o String name
}

concept SampleConcept {
concept SampleConceptA {
o String description
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid
namespace org.concerto.concepts.cd003.valid@1.0.0

concept SampleConceptA {
o String name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid
namespace org.concerto.concepts.cd004.valid@1.0.0

concept BaseConcept {
o String baseProperty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid
namespace org.[email protected]

concept DerivedConcept extends NonExistentConcept {
o String detail
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid
namespace org.concerto.concepts.cd005.invalid@1.0.0

concept Entity identified by id {
o Integer id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.scalarid
namespace org.[email protected]

scalar CustomString extends String

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid
namespace org.concerto.concepts.cd005.valid@1.0.0

concept Entity identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid
namespace org.concerto.concepts.cd006.invalid@1.0.0

concept Product identified by productId {
o String productId optional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid
namespace org.concerto.concepts.cd006.valid@1.0.0

concept Product identified by productId {
o String productId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid
namespace org.concerto.concepts.cd007.invalid@1.0.0

concept BaseConcept {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid
namespace org.concerto.concepts.cd007.valid@1.0.0

concept BaseConcept identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid
namespace org.concerto.concepts.cd008.invalid@1.0.0

concept BaseConcept {
o String name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid
namespace org.concerto.concepts.cd008.valid@1.0.0

concept BaseConcept {
o String name
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace org.invalid.circular

concept A extends C {
o String name
}

concept B extends A {
o String description
}

concept C extends B {
o String detail
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace org.valid.circular

concept A {
o String name
}

concept B extends A {
o String description
}

concept C extends B {
o String detail
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace org.inherited.duplicate

concept Parent {
o String name
}

concept Child extends Parent {
o String name
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace org.inherited.valid

concept Parent {
o String name
}

concept Child extends Parent {
o String description
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid.declaration001
namespace org.example.declaration001.invalid@1.0.0

concept User identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid.declaration001
namespace org.example.declaration001.valid@1.0.0

concept User identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid.decorated001
namespace org.example.decorated001.invalid@1.0.0

concept Product identified by productId {
@custom
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid.decorated001
namespace org.example.decorated001.valid@1.0.0

concept Product identified by productId {
@custom
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid.modelelement002
namespace org.example.modelelement002.invalid@1.0.0

concept Invalid-Name {
o String something
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid.modelelement002
namespace org.example.modelelement002.valid@1.0.0

concept ValidName {
o String something
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid.property002
namespace org.example.property002.invalid@1.0.0

concept User identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid.property002
namespace org.example.property002.valid@1.0.0

concept User identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid.property003
namespace org.example.property003.invalid@1.0.0

concept Device identified by serial {
x String serial
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid.property003
namespace org.example.property003.valid@1.0.0

concept Device identified by serial {
o String serial
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid.relationship001
namespace org.example.relationship001.invalid@1.0.0

concept Person identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid.relationship001
namespace org.example.relationship001.valid@1.0.0

concept Person identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid.relationship002
namespace org.example.relationship002.valid@1.0.0

concept Student identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid.relationship002
namespace org.example.relationship002[email protected]

concept Student identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.valid.relationship003
namespace org.example.relationship003.valid@1.0.0

concept Employee identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid.relationship003
namespace org.example.relationship003.invalid@1.0.0

concept Employee identified by id {
o String id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.enums.invalid
namespace org.example.enums.declaration001.invalid@1.0.0

enum Status {
o ACTIVE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.enums.valid
namespace org.example.enums.[email protected]

enum Status {
o ACTIVE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace org.example.invalid
namespace org.example.enums.declaration002.invalid@1.0.0

import org.external.imported.ConflictEnum

Expand Down
Loading