Skip to content

Introduce structured and unstructured response headers - #283

Merged
ahl merged 11 commits into
mainfrom
headers
Feb 26, 2022
Merged

ahl merged 11 commits into
mainfrom
headers

Conversation

@ahl

@ahl ahl commented Feb 22, 2022 •

Copy link
Copy Markdown
Collaborator

This adds HttpResponseHeaders<T: HttpTypedResponse, H: JsonSchema + Serialize + Send + Sync + 'static = NoHeaders> that allows for consumers to specify structured headers (that also appear in the OpenAPI output) and unstructured, ad-hoc headers that may be specified at runtime.

Previously, we had been--in places--using schemars a little bit wrong in that we were using an intermediate form rather than its fully processed form. In particular this meant that the JSON Schema we looked at didn't always conform to the variant of JSON Schema that conforms most closely with OpenAPI v3.0.x. This delta updates our use of schemars which has the upshot of both requiring some additional handling... but also recovering some description fields that we had previously discarded unintentionally. This change also pulls descriptions that had been embedded within schemas up to the parameters they describe.

@ahl
ahl requested a review from davepacheco February 22, 2022 18:42
Comment thread dropshot/tests/test_demo.rs Resolved
Comment thread dropshot/src/handler.rs Resolved
@ahl
ahl marked this pull request as ready for review February 23, 2022 06:58
@ahl
ahl merged commit 784399a into main Feb 26, 2022
@ahl
ahl deleted the headers branch February 26, 2022 17:28
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