From c3ca0b399d96dc9881f551aea21f42ecd70acd9a Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 18 Mar 2021 14:30:37 +0100 Subject: serialize: Upcase the first letter of any property name. --- aws/serialize.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'aws/serialize.scm') diff --git a/aws/serialize.scm b/aws/serialize.scm index e9a1382..f6d12fd 100644 --- a/aws/serialize.scm +++ b/aws/serialize.scm @@ -26,6 +26,16 @@ ;; See https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html (define* (serialize-aws-value thing) + ;; XXX: I don't know why this is necessary, but it seems to be + ;; required that the locationName begin with an uppercase letter. + ;; There is nothing in the specification that would hint at this, + ;; but testing against the AWS API have revealed this to be the + ;; case. This is at least true for "Value" and "Key" of a "Tag" + ;; value, and for "ResourceType" of a "TagSpecification". + (define (up string) + (let ((s (format #false "~a" string))) + (string-set! s 0 (char-upcase (string-ref s 0))) + s)) (define inner (lambda (path thing) (cond @@ -63,7 +73,7 @@ (else (format #false "~{~a~^.~}=~a" - (reverse (filter identity path)) + (map up (reverse (filter identity path))) thing))))) (define (flatten lst) (match lst -- cgit v1.2.3