Skip to content

feat(engine): bracket-notation form bodies parse into nested dicts/lists - #56

Merged
deblasis merged 1 commit into
mainfrom
feat/form-bracket-parsing
Aug 16, 2026
Merged

feat(engine): bracket-notation form bodies parse into nested dicts/lists#56
deblasis merged 1 commit into
mainfrom
feat/form-bracket-parsing

Conversation

@deblasis

Copy link
Copy Markdown
Contributor

Provider SDKs POST urlencoded request bodies in the Rails/PHP bracket shape — stripe-node sends line_items[0][price_data][currency]=usd&line_items[0][quantity]=1 — which the flat form parser delivered to handlers as literal flat keys, so body.get("line_items") was None and every SDK-driven create 400'd. Found by dogfooding a real stripe-node client against the stripe-style adapter.

  • a[b]=v → nested dicts; a[]=v → list appends (all repeated values); a[0][b]=v → indexed lists with same-index merge — the shapes SDKs actually emit
  • Malformed bracketing falls back to the historical flat-key behavior
  • Scalar/structure collisions at one path skip order-independently (ParseQuery's map iteration is unordered)
  • Test matrix incl. a full stripe-shaped body, 10× repeat-stable

Gates: full suite, adapter lint (94), gofmt, vet — green.

Provider SDKs POST urlencoded bodies in the Rails/PHP bracket shape
(stripe-node: line_items[0][price_data][currency]=usd&…), which the
flat form parser handed handlers as literal keys — body.get(
"line_items") was None and every SDK-driven create 400'd. Bracket
keys now expand to the nested structure handlers expect: a[b]=v ->
dicts, a[]=v -> appends, a[0][b]=v -> indexed lists with merge.
Malformed bracketing keeps the flat fallback; scalar/structure
collisions at one path skip order-independently instead of clobbering.
Found by dogfooding a real stripe-node client against stripe-style.
@deblasis
deblasis merged commit b7d0b97 into main Aug 16, 2026
1 check passed
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.

1 participant