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

Add response schema validation methods & test helpers #18635

Merged
merged 24 commits into from
Jan 13, 2023

Conversation

averche
Copy link
Contributor

@averche averche commented Jan 9, 2023

This pull request adds 3 functions (and corresponding tests):

testhelpers/response_validation.go:

  • ValidateResponse
  • ValidateResponseData

field_data.go:

  • ValidateStrict (has the "strict" validation logic)

The functions are primarily meant to be used in tests to ensure that the responses are consistent with the defined response schema. An example of how the functions can be used in tests can be found in #18636.

Background

This PR is part of the ongoing work to add structured responses in Vault OpenAPI (VLT-234)

@averche averche added this to the 1.13.0-rc1 milestone Jan 9, 2023
@averche averche marked this pull request as ready for review January 11, 2023 17:07
@averche averche requested review from dhuckins, lursu and AnPucel January 11, 2023 17:36
@averche averche changed the title Add response schema validation Add response schema validation methods & test helpers Jan 11, 2023
@averche averche requested a review from a team January 11, 2023 21:02
Copy link
Collaborator

@lursu lursu left a comment

Choose a reason for hiding this comment

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

Just a question on the interface but otherwise LGTM.

sdk/framework/field_data.go Show resolved Hide resolved
sdk/helper/testhelpers/response_validation.go Outdated Show resolved Hide resolved
sdk/helper/testhelpers/response_validation.go Outdated Show resolved Hide resolved

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@averche averche merged commit 6a25867 into main Jan 13, 2023
@averche averche deleted the response-schema-validation branch January 13, 2023 19:56
AnPucel pushed a commit that referenced this pull request Feb 3, 2023
This pull request adds 3 functions (and corresponding tests):

`testhelpers/response_validation.go`:

  - `ValidateResponse`
  - `ValidateResponseData`
  
field_data.go:

  - `ValidateStrict` (has the "strict" validation logic)

The functions are primarily meant to be used in tests to ensure that the responses are consistent with the defined response schema. An example of how the functions can be used in tests can be found in #18636.

### Background

This PR is part of the ongoing work to add structured responses in Vault OpenAPI (VLT-234)
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.

None yet

2 participants