chore: add channelKey validation rule #202
Merged
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.
This pull request introduces several changes to the
LEGO.AsyncAPI
project, focusing on enhancing validation rules for channel keys and adding corresponding tests. The most important changes include adding a new validation rule to ensure channel keys are unique, updating existing regex validations, and adding new unit tests to verify the functionality.Enhancements to Validation Rules:
src/LEGO.AsyncAPI/Resource.Designer.cs
: Added a new localized stringValidation_ChannelsMustBeUnique
to provide an error message when channel keys are not unique.src/LEGO.AsyncAPI/Resource.resx
: Added the corresponding resource entry forValidation_ChannelsMustBeUnique
.src/LEGO.AsyncAPI/Validation/Rules/AsyncApiDocumentRules.cs
: Introduced a new regexChannelKeyUriTemplateRegex
with a timeout and added logic to ensure channel keys are unique and match the specified regex. [1] [2] [3]Unit Tests:
test/LEGO.AsyncAPI.Tests/Validation/ValidationRuleTests.cs
: Added new unit tests to verify the new validation rules, including tests for invalid channel keys, non-unique channel keys, and valid channel keys.test/LEGO.AsyncAPI.Tests/Validation/ValidationRulesetTests.cs
: Updated the test file to include necessary imports for FluentAssertions and other dependencies.