Skip to content

feat: schema inference from network requests (GLA-46)#6

Merged
paoloanzn merged 1 commit intomainfrom
paolo/gla-46-schema-inference
Mar 7, 2026
Merged

feat: schema inference from network requests (GLA-46)#6
paoloanzn merged 1 commit intomainfrom
paolo/gla-46-schema-inference

Conversation

@paoloanzn
Copy link
Contributor

@paoloanzn paoloanzn commented Mar 7, 2026

Summary

  • Adds schema-inferrer.js module that extracts typed schemas from a single captured network request, covering both request and response sides
  • Header schemas: field name, inferred value type (string, integer, number, boolean, empty), and isAuth flag for auth headers (Authorization, bearer tokens, x-api-key, Cookie, x-auth-*)
  • Body schemas: recursive type inference for JSON payloads (string, number, boolean, null, array, object with named fields) and URL-encoded form data with value coercion
  • Supports schema unification across array items (mixed type with variants) and optional field tracking for future schema merging (GLA-47)
  • Integrates into export payload (schema field per request) and panel UI (new "Inferred Schema" detail section)

Test plan

  • Load extension in Chrome DevTools, trigger network requests with JSON request/response bodies
  • Verify "Inferred Schema" section appears in request detail view with correct types
  • Test with form-urlencoded POST bodies — schema should parse key/value pairs with coerced types
  • Test auth header detection: requests with Authorization: Bearer ..., x-api-key, Cookie headers should have isAuth: true
  • Export snapshot JSON and verify each request includes a schema object with request.headers, request.body, response.headers, response.body
  • Test with array responses containing mixed types — schema items should show mixed type with variants

🤖 Generated with Claude Code

Add schema-inferrer.js that extracts typed schemas from captured
network requests. For both request and response sides it produces:

- Header schemas: field name, inferred value type (string, integer,
  number, boolean, empty), and auth flag for Authorization, bearer
  tokens, x-api-key, cookie, and x-auth-* headers.
- Body schemas: recursive type inference (string, number, boolean,
  null, array, object) for JSON payloads and URL-encoded form data.
  Arrays unify item schemas across elements; object fields are
  enumerated with their types. Mixed-type values and optional fields
  are tracked for future schema merging (GLA-47).

Integrates into panel.js: each exported request includes its inferred
schema object, and the request detail view renders an "Inferred Schema"
section showing the full schema as formatted JSON.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear
Copy link

linear bot commented Mar 7, 2026

GLA-46 Schema inference

From a single observation, extract a typed schema for both request and response.

  • Headers: field names + value types, flag auth headers (Authorization, x-auth-token, bearer tokens, cookies used as auth)
  • Payload: field names + inferred types (string, number, boolean, null, array, object), handling both JSON and form data
  • Same treatment for response headers and response body

Done when a single request produces a structured schema object.

@paoloanzn paoloanzn merged commit 74ec300 into main Mar 7, 2026
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