Add problem details JSON body with supported content type #226
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 269 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.335
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #226"
general
weight: 0.35
czechboy0
Motivation
Closes https://github.com/apple/swift-openapi-generator/issues/963
When returning a 406, right now we only return the code. Figuring out what code (and thus content type) we were actually trying to return requires the user to dig into the OpenAPI doc/server codebase more: https://github.com/apple/swift-openapi-runtime/blob/49689c749c36542443e91c1bff4da2e2a5f28dc3/Sources/OpenAPIRuntime/Errors/RuntimeError.swift#L168
Modifications
Enables returning problem details error as the http body of the response when the server encountered a runtime error. https://www.rfc-editor.org/rfc/rfc9457.html.
For https://github.com/apple/swift-openapi-generator/issues/963, along with human readable informations specific to the problem type, it includes two machine-readable extension fields to help clients diagnose and correct the mismatch of the particular problem details instance:
responseContentType: A string with the content type of the response that the server tried to send.acceptableContentTypes: An array of strings with the media ranges, such asapplication/jsonortext/*, listed in the request'sAcceptheader field, without parameters such as quality values.Further, we add a root documentation folder to document supported problem details types and refer to that documentation in the problem details
typefield. https://www.rfc-editor.org/rfc/rfc9457.html#name-typeResult
Test Plan
testRuntimeError_withUnexpectedAcceptHeader_returnsProblemDetailstoTest_RuntimeError.testValidateAccept_notAcceptable_reportsContentTypestoTest_Converter+Server.