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

Introduce structured and unstructured response headers #283

Merged
merged 11 commits into from
Feb 26, 2022
Merged

Introduce structured and unstructured response headers #283

merged 11 commits into from
Feb 26, 2022

Conversation

ahl
Copy link
Collaborator

@ahl ahl commented Feb 22, 2022

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
dropshot/tests/test_demo.rs Show resolved Hide resolved
dropshot/src/handler.rs Show resolved Hide 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