Repository navigation
Core dto validator is added. #445
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
Open
zeynepatsoprasteria
wants to merge
5
commits into
development
Choose a base branch
from
406-feature-core-dto-validator
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
....CodeGenerator.Tests/Expected/UML/Core/AutoGenDtoValidators/AnnotatingElementValidator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // <copyright file="AnnotatingElementValidator.cs" company="Starion Group S.A."> | ||
| // | ||
| // Copyright (C) 2022-2026 Starion Group S.A. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // </copyright> | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // <auto-generated /> | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace SysML2.NET.Validation.Core.DTO | ||
| { | ||
| using System.CodeDom.Compiler; | ||
|
|
||
| using FluentValidation; | ||
|
|
||
| using SysML2.NET.Core.DTO.Root.Annotations; | ||
|
|
||
| /// <summary> | ||
| /// Validates a <see cref="AnnotatingElement"/> against the multiplicities and types of the non-derived properties of the AnnotatingElement metaclass. | ||
| /// A rule inferred from a required derived property only checks the lower bound of its storage, not its upper bound or element type. | ||
| /// </summary> | ||
| [GeneratedCode("SysML2.NET", "latest")] | ||
| public sealed partial class AnnotatingElementValidator : DtoValidator<AnnotatingElement> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AnnotatingElementValidator"/> class | ||
| /// and registers its generated rules | ||
| /// </summary> | ||
| public AnnotatingElementValidator() | ||
| { | ||
| this.RuleFor(dto => dto.ElementId).NotNull(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ |
43 changes: 43 additions & 0 deletions
43
...L2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenDtoValidators/AssociationValidator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // <copyright file="AssociationValidator.cs" company="Starion Group S.A."> | ||
| // | ||
| // Copyright (C) 2022-2026 Starion Group S.A. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // </copyright> | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // <auto-generated /> | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace SysML2.NET.Validation.Core.DTO | ||
| { | ||
| using System.CodeDom.Compiler; | ||
|
|
||
| using FluentValidation; | ||
|
|
||
| using SysML2.NET.Core.DTO.Kernel.Associations; | ||
|
|
||
| /// <summary> | ||
| /// Validates a <see cref="Association"/> against the multiplicities and types of the non-derived properties of the Association metaclass. | ||
| /// A rule inferred from a required derived property only checks the lower bound of its storage, not its upper bound or element type. | ||
| /// </summary> | ||
| [GeneratedCode("SysML2.NET", "latest")] | ||
| public sealed partial class AssociationValidator : DtoValidator<Association> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AssociationValidator"/> class | ||
| /// and registers its generated rules | ||
| /// </summary> | ||
| public AssociationValidator() | ||
| { | ||
| this.RuleFor(dto => dto.ElementId).NotNull(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ |
45 changes: 45 additions & 0 deletions
45
SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenDtoValidators/DependencyValidator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // <copyright file="DependencyValidator.cs" company="Starion Group S.A."> | ||
| // | ||
| // Copyright (C) 2022-2026 Starion Group S.A. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // </copyright> | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // <auto-generated /> | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace SysML2.NET.Validation.Core.DTO | ||
| { | ||
| using System.CodeDom.Compiler; | ||
|
|
||
| using FluentValidation; | ||
|
|
||
| using SysML2.NET.Core.DTO.Root.Dependencies; | ||
|
|
||
| /// <summary> | ||
| /// Validates a <see cref="Dependency"/> against the multiplicities and types of the non-derived properties of the Dependency metaclass. | ||
| /// A rule inferred from a required derived property only checks the lower bound of its storage, not its upper bound or element type. | ||
| /// </summary> | ||
| [GeneratedCode("SysML2.NET", "latest")] | ||
| public sealed partial class DependencyValidator : DtoValidator<Dependency> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="DependencyValidator"/> class | ||
| /// and registers its generated rules | ||
| /// </summary> | ||
| public DependencyValidator() | ||
| { | ||
| this.RuleFor(dto => dto.Client).NotEmpty(); | ||
| this.RuleFor(dto => dto.ElementId).NotNull(); | ||
| this.RuleFor(dto => dto.Supplier).NotEmpty(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ |
43 changes: 43 additions & 0 deletions
43
...eGenerator.Tests/Expected/UML/Core/AutoGenDtoValidators/EnumerationDefinitionValidator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // <copyright file="EnumerationDefinitionValidator.cs" company="Starion Group S.A."> | ||
| // | ||
| // Copyright (C) 2022-2026 Starion Group S.A. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // </copyright> | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // <auto-generated /> | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace SysML2.NET.Validation.Core.DTO | ||
| { | ||
| using System.CodeDom.Compiler; | ||
|
|
||
| using FluentValidation; | ||
|
|
||
| using SysML2.NET.Core.DTO.Systems.Enumerations; | ||
|
|
||
| /// <summary> | ||
| /// Validates a <see cref="EnumerationDefinition"/> against the multiplicities and types of the non-derived properties of the EnumerationDefinition metaclass. | ||
| /// A rule inferred from a required derived property only checks the lower bound of its storage, not its upper bound or element type. | ||
| /// </summary> | ||
| [GeneratedCode("SysML2.NET", "latest")] | ||
| public sealed partial class EnumerationDefinitionValidator : DtoValidator<EnumerationDefinition> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="EnumerationDefinitionValidator"/> class | ||
| /// and registers its generated rules | ||
| /// </summary> | ||
| public EnumerationDefinitionValidator() | ||
| { | ||
| this.RuleFor(dto => dto.ElementId).NotNull(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ |
45 changes: 45 additions & 0 deletions
45
....NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenDtoValidators/FeatureTypingValidator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // <copyright file="FeatureTypingValidator.cs" company="Starion Group S.A."> | ||
| // | ||
| // Copyright (C) 2022-2026 Starion Group S.A. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // </copyright> | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // <auto-generated /> | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace SysML2.NET.Validation.Core.DTO | ||
| { | ||
| using System.CodeDom.Compiler; | ||
|
|
||
| using FluentValidation; | ||
|
|
||
| using SysML2.NET.Core.DTO.Core.Features; | ||
|
|
||
| /// <summary> | ||
| /// Validates a <see cref="FeatureTyping"/> against the multiplicities and types of the non-derived properties of the FeatureTyping metaclass. | ||
| /// A rule inferred from a required derived property only checks the lower bound of its storage, not its upper bound or element type. | ||
| /// </summary> | ||
| [GeneratedCode("SysML2.NET", "latest")] | ||
| public sealed partial class FeatureTypingValidator : DtoValidator<FeatureTyping> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="FeatureTypingValidator"/> class | ||
| /// and registers its generated rules | ||
| /// </summary> | ||
| public FeatureTypingValidator() | ||
| { | ||
| this.RuleFor(dto => dto.ElementId).NotNull(); | ||
| this.RuleFor(dto => dto.Type).NotEmpty(); | ||
| this.RuleFor(dto => dto.TypedFeature).NotEmpty(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ |
45 changes: 45 additions & 0 deletions
45
SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenDtoValidators/FeatureValidator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // <copyright file="FeatureValidator.cs" company="Starion Group S.A."> | ||
| // | ||
| // Copyright (C) 2022-2026 Starion Group S.A. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // </copyright> | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // <auto-generated /> | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace SysML2.NET.Validation.Core.DTO | ||
| { | ||
| using System.CodeDom.Compiler; | ||
|
|
||
| using FluentValidation; | ||
|
|
||
| using SysML2.NET.Core.Core.Types; | ||
| using SysML2.NET.Core.DTO.Core.Features; | ||
|
|
||
| /// <summary> | ||
| /// Validates a <see cref="Feature"/> against the multiplicities and types of the non-derived properties of the Feature metaclass. | ||
| /// A rule inferred from a required derived property only checks the lower bound of its storage, not its upper bound or element type. | ||
| /// </summary> | ||
| [GeneratedCode("SysML2.NET", "latest")] | ||
| public sealed partial class FeatureValidator : DtoValidator<Feature> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="FeatureValidator"/> class | ||
| /// and registers its generated rules | ||
| /// </summary> | ||
| public FeatureValidator() | ||
| { | ||
| this.RuleFor(dto => dto.Direction).IsInEnum(); | ||
| this.RuleFor(dto => dto.ElementId).NotNull(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ |
45 changes: 45 additions & 0 deletions
45
SysML2.NET.CodeGenerator.Tests/Expected/UML/Core/AutoGenDtoValidators/FlowValidator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // <copyright file="FlowValidator.cs" company="Starion Group S.A."> | ||
| // | ||
| // Copyright (C) 2022-2026 Starion Group S.A. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // </copyright> | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // <auto-generated /> | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace SysML2.NET.Validation.Core.DTO | ||
| { | ||
| using System.CodeDom.Compiler; | ||
|
|
||
| using FluentValidation; | ||
|
|
||
| using SysML2.NET.Core.Core.Types; | ||
| using SysML2.NET.Core.DTO.Kernel.Interactions; | ||
|
|
||
| /// <summary> | ||
| /// Validates a <see cref="Flow"/> against the multiplicities and types of the non-derived properties of the Flow metaclass. | ||
| /// A rule inferred from a required derived property only checks the lower bound of its storage, not its upper bound or element type. | ||
| /// </summary> | ||
| [GeneratedCode("SysML2.NET", "latest")] | ||
| public sealed partial class FlowValidator : DtoValidator<Flow> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="FlowValidator"/> class | ||
| /// and registers its generated rules | ||
| /// </summary> | ||
| public FlowValidator() | ||
| { | ||
| this.RuleFor(dto => dto.Direction).IsInEnum(); | ||
| this.RuleFor(dto => dto.ElementId).NotNull(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ |
49 changes: 49 additions & 0 deletions
49
...enerator.Tests/Expected/UML/Core/AutoGenDtoValidators/FramedConcernMembershipValidator.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // ------------------------------------------------------------------------------------------------ | ||
| // <copyright file="FramedConcernMembershipValidator.cs" company="Starion Group S.A."> | ||
| // | ||
| // Copyright (C) 2022-2026 Starion Group S.A. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| // </copyright> | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // <auto-generated /> | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
|
|
||
| namespace SysML2.NET.Validation.Core.DTO | ||
| { | ||
| using System.CodeDom.Compiler; | ||
|
|
||
| using FluentValidation; | ||
|
|
||
| using SysML2.NET.Core.Root.Namespaces; | ||
| using SysML2.NET.Core.Systems.Requirements; | ||
| using SysML2.NET.Core.DTO.Systems.Requirements; | ||
|
|
||
| /// <summary> | ||
| /// Validates a <see cref="FramedConcernMembership"/> against the multiplicities and types of the non-derived properties of the FramedConcernMembership metaclass. | ||
| /// A rule inferred from a required derived property only checks the lower bound of its storage, not its upper bound or element type. | ||
| /// </summary> | ||
| [GeneratedCode("SysML2.NET", "latest")] | ||
| public sealed partial class FramedConcernMembershipValidator : DtoValidator<FramedConcernMembership> | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="FramedConcernMembershipValidator"/> class | ||
| /// and registers its generated rules | ||
| /// </summary> | ||
| public FramedConcernMembershipValidator() | ||
| { | ||
| this.RuleFor(dto => dto.ElementId).NotNull(); | ||
| this.RuleFor(dto => dto.Kind).IsInEnum(); | ||
| this.RuleFor(dto => dto.OwnedRelatedElement).NotEmpty(); | ||
| this.RuleFor(dto => dto.OwningRelatedElement).NotEmpty(); | ||
| this.RuleFor(dto => dto.Visibility).IsInEnum(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // ------------------------------------------------------------------------------------------------ | ||
| // --------THIS IS AN AUTOMATICALLY GENERATED FILE. ANY MANUAL CHANGES WILL BE OVERWRITTEN!-------- | ||
| // ------------------------------------------------------------------------------------------------ | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule is computed based on the need of derived property.
Pure error shall come on non-derived property.
I would prefer to se the severity as Warning when a rule is there due to a derivation check