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

DMP-4366: Add and adjust admin portal API validations #2409

Merged
merged 10 commits into from
Jan 13, 2025
Merged

Conversation

Ben-Edwards-cgi
Copy link
Contributor

Links

Jira

Change description

Summary of Git Diff

This Git diff outlines various updates made to multiple OpenAPI YAML files. The changes primarily involve the addition of maxLength, minimum, and maximum constraints for several fields across different components, enhancing the validation of input data.

Highlights

  • audio.yaml:

    • Added maxLength: 64 to courtroom_name.
  • audiorequests.yaml:

    • Added minimum: 1 and maximum: 2147483647 to media_request_id.
    • Added maxLength: 32 to case_number.
    • Added maxLength: 2000 to owner and requested_by.
  • cases.yaml:

    • Added maxLength: 64 to courtroom_name.
  • courthouse.yaml:

    • Added maxLength: 255 to courthouse_name in two locations.
  • event.yaml:

    • Added maxLength: 64 to courtroom_name.
  • hearings.yaml:

    • Added maxLength: 64 to courtroom_name.
  • transcriptions.yaml:

    • Added minimum: 1 and maximum: 2147483647 to transcription_id.
    • Added maxLength: 32 to case_number.
    • Added maxLength: 2000 to owner and requested_by in multiple sections.

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[X] No

@Ben-Edwards-cgi Ben-Edwards-cgi requested review from a team as code owners January 2, 2025 17:49
@Ben-Edwards-cgi Ben-Edwards-cgi requested review from davet1985, jackmaloney, hemantasharma1129, Abhivan, gunnertwin and ryanmcalary11 and removed request for a team January 2, 2025 17:49
Copy link
Contributor

@karen-hedges karen-hedges left a comment

Choose a reason for hiding this comment

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

Should there be tests to show the endpoints fail if the size of whats constrained fails?

@Ben-Edwards-cgi
Copy link
Contributor Author

We could create dedicated tests to confirm the constrains are hit successfully, however this seems redundant as we use a third party library to manage all of this for us as such as long as the swagger is accurate the validation should work as the library would have there own tests to verify all the validation is applied correctly

@jackmaloney
Copy link
Contributor

We could create dedicated tests to confirm the constrains are hit successfully, however this seems redundant as we use a third party library to manage all of this for us as such as long as the swagger is accurate the validation should work as the library would have there own tests to verify all the validation is applied correctly

@Ben-Edwards-cgi just discussing with Karen, do you not want an integration test(s) to make sure the application behaves as expected when one of these limits is exceeded?

@Ben-Edwards-cgi
Copy link
Contributor Author

We could create dedicated tests to confirm the constrains are hit successfully, however this seems redundant as we use a third party library to manage all of this for us as such as long as the swagger is accurate the validation should work as the library would have there own tests to verify all the validation is applied correctly

@Ben-Edwards-cgi just discussing with Karen, do you not want an integration test(s) to make sure the application behaves as expected when one of these limits is exceeded?

@jackmaloney As this is an ingres point for the application rather then an endpoint we consume, our application does not care about the response, we would just chuck a 400 for the FE to handle in the same way we handle all other schema validation failures. So I don't think there is much if any additional value gained for adding additional tests for this.

@davet1985
Copy link
Contributor

We could create dedicated tests to confirm the constrains are hit successfully, however this seems redundant as we use a third party library to manage all of this for us as such as long as the swagger is accurate the validation should work as the library would have there own tests to verify all the validation is applied correctly

@Ben-Edwards-cgi just discussing with Karen, do you not want an integration test(s) to make sure the application behaves as expected when one of these limits is exceeded?

@jackmaloney As this is an ingres point for the application rather then an endpoint we consume, our application does not care about the response, we would just chuck a 400 for the FE to handle in the same way we handle all other schema validation failures. So I don't think there is much if any additional value gained for adding additional tests for this.

I don't think it's worth adding tests to test the swagger constraints, we have tests on the frontend to check the implementation there and the backend constraints are a fallback. As we are simply adding configuration, swagger should be behaving as specified. I know there's always a risk that it might not, but the risk here is tiny.

@Ben-Edwards-cgi Ben-Edwards-cgi enabled auto-merge (squash) January 13, 2025 09:30
@Ben-Edwards-cgi Ben-Edwards-cgi merged commit 1050849 into master Jan 13, 2025
10 checks passed
@Ben-Edwards-cgi Ben-Edwards-cgi deleted the DMP-4366 branch January 13, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants