Skip to content

feat: record validation in TOML#122

Merged
arl merged 7 commits intoAdRoll:mainfrom
lucarin91:feat_validation_conf
Feb 3, 2021
Merged

feat: record validation in TOML#122
arl merged 7 commits intoAdRoll:mainfrom
lucarin91:feat_validation_conf

Conversation

@lucarin91
Copy link
Copy Markdown
Contributor

@lucarin91 lucarin91 commented Feb 2, 2021

❓ What

Make it possible to declare Record validation from TOML. A new Validation key is added in the TOML, where the user can set a regex for each of the field names.

[Validation]
name = “^[a-z]*$“
timestamp = “^[0-9]*“

To avoid conflicts the validation could be omitted or set just one time either on the Component object or in the TOML.

🔨 How to test

  1. Add the Validation key on a Baker TOML
  2. Make sure that no validation function is passed during the configuration
  3. Records should be correctly validated and failed one throw away

✅ Checklists

  • Is there unit/integration test coverage for all new and/or changed functionality added in this PR?
  • Have the changes in this PR been functionally tested?
  • Have new components been added to the documentation website?
  • Has make gofmt-write been run on the code?
  • Has make govet been run on the code? Has the code been fixed accordingly to the output?
  • Have the changes been added to the CHANGELOG.md file?
  • Have the steps in CONTRIBUTING.md been followed to update a Go module?

Copy link
Copy Markdown
Collaborator

@arl arl left a comment

Choose a reason for hiding this comment

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

Some comments here and there to update and the end-to-end test also, but the non-test code looks good to me.

Good job 👍

Comment thread config.go Outdated
Comment thread examples/validation/main.go Outdated
Comment thread e2e_test.go
Comment thread examples/validation/main.go
@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 3, 2021

Codecov Report

Merging #122 (1cd3b63) into main (adc3a54) will increase coverage by 0.38%.
The diff coverage is 92.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
+ Coverage   45.95%   46.33%   +0.38%     
==========================================
  Files          52       52              
  Lines        3669     3695      +26     
==========================================
+ Hits         1686     1712      +26     
  Misses       1791     1791              
  Partials      192      192              
Impacted Files Coverage Δ
config.go 65.00% <92.59%> (+5.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update adc3a54...1cd3b63. Read the comment docs.

Copy link
Copy Markdown
Collaborator

@arl arl left a comment

Choose a reason for hiding this comment

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

LGTM

@arl arl merged commit dc697e5 into AdRoll:main Feb 3, 2021
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