Skip to content

feat: casing engine + schema_driven_xml transform (schema-driven provider machinery)#107

Merged
general-kroll-4-life merged 1 commit into
mainfrom
feature/native-aws-updates
Jun 28, 2026
Merged

feat: casing engine + schema_driven_xml transform (schema-driven provider machinery)#107
general-kroll-4-life merged 1 commit into
mainfrom
feature/native-aws-updates

Conversation

@jeffreyaven

Copy link
Copy Markdown
Member

What

Provider-agnostic, opt-in machinery that lets specs move from per-op verbose Go templates to schema-driven, casing-aware handling. Everything is gated behind new per-spec flags/extensions, so existing providers (google, okta, github, awscc, ...) see zero behaviour change. Motivated by the native AWS provider; no AWS knowledge is hard-coded in core.

Two cleanly separable features (could be split into two PRs if preferred; bundled here):

1. casing engine (pkg/casing)

  • Port of botocore's xform_name (snake) + inverses for pascal | kebab | camel, with a cache.
  • Output: when config.snake_case_aliases: true, top-level response column names are snake-aliased at the SQL surface; the wire name is retained on the schema for response navigation.
  • Input: when a method's request.nativeCasing is set (pascal | kebab | camel | snake), an unresolved snake SQL key is reverse-cased to the wire form and re-resolved (parameters and one level of request-body properties). Final miss yields a typed ParameterNotFoundError listing wire-format keys.
  • Top-level only; nested struct contents are passed verbatim (matches the AWS CLI).

Wiring: const.go, config.go, provider.go (IsSnakeCaseAliasesEnabled), expectedRequest.go (GetNativeCasing), operation_store.go (GetRequestNativeCasing, reverse-casing in GetParameter/body matcher, GetParameterOrError), schema.go (getPropertiesColumns), radix_tree_address_space/legacy_address_space.go (GetColumns).

2. schema_driven_xml transform (pkg/stream_transform)

  • New StreamTransformer family schema_driven_xml_v0.1.0 (distinct from golang_template_mxj_v*).
  • Reads the response.schema_override schema, walks mxj-decoded XML, and projects rows into the {"<objectKey>": [...]} envelope. Decodes mxj WITHOUT casting and applies the schema's declared type, so 12-digit IDs stay strings, booleans stay booleans, objects/arrays are JSON-stringified, and self-closing elements become null.
  • Skips the query / ec2 / rest-xml envelope based on info.x-protocol; handles list and singleton (incl. singleton-with-ancillary-list) shapes.
  • The package stays free of internal/anysdk (consumes a neutral SchemaTree); the operation store adapts its Schema and dispatches in getOverridenResponse.

Tests

  • pkg/casing: ToSnake (incl. acronyms), FromSnake for all 4 casings, round-trip, edge cases.
  • pkg/stream_transform: ec2 list/small, query resultWrapper, query empty self-closing, rest-xml list/singleton/ancillary-list, type-dispatch, factory registration.
  • internal: ParameterNotFoundError formatting.

Notes

  • Additive + backward compatible: no flag / no extension => no behaviour change. Existing tests should pass unchanged.
  • The mock-provider integration test and the robot tests live in the stackql repo (separate work item).
  • GetOperationParameter (a secondary parameter path) was intentionally not extended; the primary GetParameter resolution carries reverse-casing.
  • Built/verified by the engine packages' own unit tests; full go test ./... + golangci-lint to be run in CI.

@general-kroll-4-life general-kroll-4-life merged commit bcf2e39 into main Jun 28, 2026
9 checks passed
@general-kroll-4-life general-kroll-4-life deleted the feature/native-aws-updates branch June 28, 2026 04:51
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