fix(api): Enable to set recommendation and decision in risk_acceptance#12303
Merged
Maffooch merged 1 commit intoApr 29, 2025
Conversation
3823e9b to
b52dea9
Compare
|
No security concerns detected in this pull request. All finding details can be found in the DryRun Security Dashboard. |
blakeaowens
approved these changes
Apr 25, 2025
Maffooch
approved these changes
Apr 28, 2025
dogboat
approved these changes
Apr 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Until now, the API endpoint


POST /api/v2/risk_acceptance/(which also applies toPUTandPATCH) has not acceptedrecommendationanddecision. As a result, DD used the default value (fix for recommendation and accept for decision). There was no error message.For
GETrequests, DD translated the chosen value (one ofA,V,M,F,T) to human-readable form.It sounds nice, but not if it means that fields are not writable.
Solution
This PR dropped

SerializerMethodFields withget_...methods, which locked these fields to read-only mode. Now, during the creation of RiskAcc, the user is able to definerecommendationanddecision.But
The only "disadvantage" is that it is now unable to see a human-readable form anymore.

No buts
APIs are not for humans but for machines, so simple values should not be the issue.
Translation is still possible based on the description in the OpenAPI spec:
or