gcp-ingestion icon indicating copy to clipboard operation
gcp-ingestion copied to clipboard

Normalize namespace and docType within ParseUri

Open jklukas opened this issue 3 years ago • 1 comments

In ParseUri we don't normalize the doctype and namespace names. Instead, we rely on SchemaStore to normalize those attributes when looking up schemas.

This means that the metadata.uri.document_namespace field in BQ may contain weird things like capital letters or extraneous punctuation like ". This sometimes complicates monitoring queries and is generally unexpected behavior. See https://github.com/mozilla/bigquery-etl/pull/2388 for an example of needing to apply normalization.

jklukas avatar Sep 29 '21 13:09 jklukas

SchemaStore uses SnakeCase for normalization, so assuming the BQ form with underscores rather than the ping form with hyphens. So I guess we don't actually have canonical logic implemented for normalizing doctype and namespace URI elements to the hyphenated form.

Another way of looking at this is that our current pipeline behavior is too lenient. We should probably be sending documents to error output if the URI contains extraneous characters like " in the doctype or namespace places. But it's probably a good thing to be tolerant of casing anomalies.

jklukas avatar Sep 29 '21 13:09 jklukas