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

IAM 776 Implement validation for groups, schemas, identities handlers #275

Merged
merged 13 commits into from
Apr 17, 2024

Conversation

BarcoMasile
Copy link
Contributor

@BarcoMasile BarcoMasile commented Apr 12, 2024

Description

This PR introduces the first implementation for the validation layer. Validation is delegated to each validatingFunction that handlers register through the RegisterValidation method. The process is run inside one middleware provided by the ValidationRegistry object.

Example:

  groupsAPI := groups.NewAPI(/*...*/)
  groupsAPI.RegisterValidation(vldtr)

Changes

  • enahnced Validation errors with detailed errors for the UI to consume
  • added tests
  • api struct validators (3rd party) enhanced to let errors use the json field name to avoid discrepancy between fields used by UI and fields referenced by backend errors
  • added validation constraint on URL Params for endpoints to forbid empty values
  • added implementation of validation process for the following handlers
    • schemas
    • groups
    • identities

Missing

Tests for new validation functions for handlers.

@BarcoMasile BarcoMasile force-pushed the IAM-776-validating-funcs branch 2 times, most recently from 3e69952 to 590bfbc Compare April 12, 2024 10:32
internal/validation/registry_test.go Show resolved Hide resolved
internal/validation/types.go Show resolved Hide resolved
pkg/groups/handlers.go Show resolved Hide resolved
pkg/groups/validation.go Outdated Show resolved Hide resolved
pkg/groups/handlers.go Outdated Show resolved Hide resolved
pkg/groups/handlers.go Outdated Show resolved Hide resolved
pkg/groups/handlers.go Outdated Show resolved Hide resolved
pkg/identities/handlers.go Outdated Show resolved Hide resolved
@BarcoMasile BarcoMasile force-pushed the IAM-776-validating-funcs branch 2 times, most recently from 9648bbb to a5bed76 Compare April 16, 2024 14:17
@BarcoMasile BarcoMasile marked this pull request as ready for review April 16, 2024 14:17
@BarcoMasile BarcoMasile requested a review from a team as a code owner April 16, 2024 14:17
@BarcoMasile BarcoMasile force-pushed the IAM-776-validating-funcs branch from a5bed76 to 4f574d1 Compare April 16, 2024 14:24
@BarcoMasile BarcoMasile requested a review from shipperizer April 16, 2024 14:25
@BarcoMasile BarcoMasile force-pushed the IAM-776-validating-funcs branch from ce1f9c8 to 0ed8519 Compare April 16, 2024 15:09
internal/validation/registry.go Show resolved Hide resolved
internal/validation/registry.go Show resolved Hide resolved
internal/validation/types.go Show resolved Hide resolved
pkg/clients/handlers.go Show resolved Hide resolved
pkg/clients/handlers.go Show resolved Hide resolved
pkg/groups/handlers.go Show resolved Hide resolved
pkg/groups/validation.go Show resolved Hide resolved
@BarcoMasile BarcoMasile merged commit 6cc4e95 into main Apr 17, 2024
6 checks passed
@BarcoMasile BarcoMasile deleted the IAM-776-validating-funcs branch April 17, 2024 10:55
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