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

PC-10133: Move api models to separate package #143

Merged
merged 33 commits into from
Oct 11, 2023

Conversation

nieomylnieja
Copy link
Collaborator

@nieomylnieja nieomylnieja commented Oct 5, 2023

API models which are not part of our IaC managed objects (SLO, Service etc.) but are simply payloads used to create and read requests to our HTTP API should be moved to a more appropriate location. Since they are directly tied to sdk.Client and its methods and don't serve any purpose outside of sdk.Client scope, they should be moved to sdk package, into a sub-package called models.

These models include:

  • Replay models
  • SLI Analysis models
  • SLO Status API models

Currently Replay models have been moved to models pkg as a role model. SLI Analysis has been moved to n9 as it does not contain all the models for all analysis endpoints.

To accommodate the changes and further polish up the validation package several major changes were introduced:

  • rename refactor to better align the API with Fluent Validation and hopefully make things clearer to read too
  • ability to include validators with Include keyword in property rules, it also results in a parent property path/name being prepended to its children
  • new validators (comparable and required)
  • added error codes concept, these are currently mostly used to ease up the testing process, since you do not to rely on checking the message (which is dynamic often times)
  • added flow execution mechanism in form of StopOnError
  • each of Rules, When, Include and StopOnError is executed sequentially, order of steps matters!

@nieomylnieja nieomylnieja changed the base branch from main to PC-10133-move-service-into-separate-package October 5, 2023 09:50
Base automatically changed from PC-10133-move-service-into-separate-package to main October 6, 2023 13:24
@nieomylnieja nieomylnieja marked this pull request as ready for review October 10, 2023 21:31
@nieomylnieja nieomylnieja requested a review from BSski October 10, 2023 21:34
.golangci.yml Show resolved Hide resolved
validation/string.go Show resolved Hide resolved
@nieomylnieja nieomylnieja merged commit f6ac5c9 into main Oct 11, 2023
3 checks passed
@nieomylnieja nieomylnieja deleted the PC-10133-move-api-models-to-separate-package branch October 11, 2023 14:13
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.

2 participants