From 06ffc37402a351f873d35516a64d080d69d22bea Mon Sep 17 00:00:00 2001 From: lloydmeta Date: Wed, 30 Oct 2024 19:52:28 +0900 Subject: [PATCH] Skip serialising empty nones Signed-off-by: lloydmeta --- README.md | 8 ++++++++ server/src/api/responses.rs | 2 ++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 8557d09..bb9a193 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,14 @@ To fulfil the above: An example Terraform config in `terraform/prod` is provided to show how to deploy at a subdomain using Cloudflare as our (free!) CDN + WAF. +## Usage: + +We only support resizing at the moment + +1. An "image" endpoint [a la Thumbor](https://thumbor.readthedocs.io/en/latest/usage.html#image-endpoint) +2. A "metadata" endpoint [a la Thumbor](https://thumbor.readthedocs.io/en/latest/usage.html#metadata-endpoint) + * Difference: target image size is _not_ returned (might change in the future) + ## Flow 1. Layer 1 validations (is the request well-formed?) diff --git a/server/src/api/responses.rs b/server/src/api/responses.rs index f7e1af9..8e3d96f 100644 --- a/server/src/api/responses.rs +++ b/server/src/api/responses.rs @@ -54,7 +54,9 @@ pub struct Source { #[derive(Serialize, Deserialize, Eq, PartialEq, Debug)] pub struct Operation { pub r#type: String, + #[serde(skip_serializing_if = "Option::is_none")] pub width: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub height: Option, }