fn top<'a>(
doc: &'a Yaml,
camel: &'static str,
snake: &'static str,
) -> Result<&'a [Yaml], String>Expand description
The one top-level member of an export request, in either dialect.
Everything below this line defaults what it cannot find, because proto3 has
no way to tell an absent repeated field from an empty one. At the top of a
request that reading is wrong in the one direction that costs data:
{"resource_log": [...]} is a typo, not an empty export, and list turns it
into the same empty slice — so the batch is dropped, answered 200 {}, and
nothing on the wire or in the log says it happened. The query API has always
refused an unknown top-level key by name because the client most likely to
misspell one is a model; the same client writes these documents.
The cost is that {} — which is what canonical proto3 JSON makes of a
request with no records in it — is now a 400 rather than a no-op. An
exporter with nothing to send does not POST, and an export that really is
empty still has its member: {"resourceLogs": []} is accepted.