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

feat: custom header validation #19

Merged
merged 18 commits into from
Nov 20, 2024
Merged

feat: custom header validation #19

merged 18 commits into from
Nov 20, 2024

Conversation

Simun17
Copy link
Collaborator

@Simun17 Simun17 commented Nov 7, 2024

Description

Added a new feature which allows validation of fields in the header. Header validation can be turned on on the Validator level by setting a specific variable in the config map, which requires each message to contain header schema ID and version. Otherwise, the validation fails because of missing required headers. Additionally, the header validation can be turned on/off on the single message level; it can be set by specifying the headerValidation flag to true/false. If headerValidation is set in message's header, Validator level flag is ignored.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (improving code structure without changing external behavior)
  • Other (please explain):

Related Issue

Checklist

  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • My code is well documented
  • I have read and understood the contribution guidelines

How Has This Been Tested?

This has been tested by setting the Validator' header validation flag to true and false. A set of messages was sent; these messages contained the same payload, but different headers. The cases that were tested are the following:

  • no new headers
  • only headerValidation header set, no headerSchemaId and headerVersionId
  • headerSchemaId and headerVersionId set, but headerValidation not set
  • headerValidation set to true/false, but missing one of headerSchemaId or headerVersionId
  • all 3 headers set
    All headers that provided sufficient info were validated correctly and in case of an error, all error messages and error codes were displayed correctly.

@Simun17 Simun17 requested a review from robe-rt November 15, 2024 14:37
robe-rt
robe-rt previously approved these changes Nov 15, 2024
@robe-rt robe-rt self-requested a review November 19, 2024 09:51
robe-rt
robe-rt previously approved these changes Nov 19, 2024
@Simun17 Simun17 closed this Nov 19, 2024
@Simun17 Simun17 reopened this Nov 19, 2024
@Simun17 Simun17 merged commit 4caa063 into dataphos:develop Nov 20, 2024
40 checks passed
Simun17 added a commit that referenced this pull request Nov 20, 2024
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.

3 participants