feat: add IntrospectMethod for DESCRIBE METHOD primitive#89
Merged
Conversation
Member
Author
|
refactor: expose introspection results via interfaces, not structs Address PR feedback: do not export concrete structures from internal/anysdk. Convert IntrospectedField and MethodIntrospection from exported structs ParamType remains an exported string type — it is a value tag with no Tests updated to use accessor methods. Full suite passes, zero |
general-kroll-4-life
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
IntrospectMethod, a new free-function entry point inany-sdkthat returns input and output field metadata for a single method on a resource. This is the any-sdk half of the upcomingDESCRIBE METHOD <provider>.<service>.<resource>.<method>SQL primitive in stackql core — designed to give agents enough schema context in one query to construct payloads and interpret responses without follow-up round trips.The resolver lives in its own file with its own types and does not mutate any existing interface. Existing
DESCRIBEpaths,SHOW METHODS,SHOW INSERT INTO, and every other code path are byte-identical tomain.What it produces
One row per input parameter (required and optional, including body fields) and one row per top-level response field. Each row carries:
name— user-facing name (renamed where stackql has a body translation algorithm configured, e.g.data__name)type— openapi type orobject/arrayparam_type—input_required|input_optional|outputshape— JSON Schema subset (text) for object/array fields; empty for scalarsdescription— populated only when theextendedflag is setThe
shapeis intentionally complete (type,format,properties,items,required,enum,default,description,readOnly/writeOnly/deprecated, and survivingoneOf/anyOf/allOf) so an agent can construct a valid payload from one DESCRIBE METHOD call. Whether a parameter goes in the path, query, header, or body is deliberately hidden — stackql treats methods as a uniform input surface.Key design decisions
formulation.go; the generatedwrappers.gois untouched.request.requiredannotations honoured. Body fields listed in the method's request annotation are promoted toinput_requiredeven when the underlying schema's required array does not list them (matchesSHOW METHODSbehaviour).$refvisited-map catches actual cycles. Cycles emit a sentinel node withx-stackql-cycle-ref.shapeistextcontaining JSON. Cross-backend portable; the SQL renderer will not depend on Postgresjsonb.Files
New:
internal/anysdk/introspection.go— resolver, JSON Schema subset renderer, cycle-guarded walker, typesinternal/anysdk/introspection_test.go— 14 tests against the in-repo google storage fixtureModified:
public/formulation/formulation.go—IntrospectMethodfree function plus type aliases (ParamType,IntrospectedField,MethodIntrospection)No other files touched.
wrappers.go,interfaces.go,schema.go,operation_store.go, and every other existing file are unchanged.Tests
Fourteen new tests, all passing locally:
buckets.getencryptioniamConfiguration.bucketPolicyOnly.enabledcorsrequest.requiredannotation onbuckets.insert(namepromoted to required)additionalProperties-only object onlabelsdelete) emits zero output rowsbucketsBackward compatibility
go test ./...runs clean on the entire repo with zero regressions. The full suite passes includinginternal/anysdk,public/discovery,public/persistence, andpublic/radix_tree_address_space.Test plan
go build ./...cleango test ./...passesgo vet ./...introduces no new warnings (pre-existing vet warnings inpkg/marshalmap,pkg/xmlmap,internal/anysdk/registry.goare unchanged)IntrospectMethodreturns the expectedbuckets.insertshape withnameasinput_requiredFollow-ups (not in this PR)
stackql-parserPR addsDESCRIBE METHODgrammar andDescribeMethodAST node.stackqlPR pulls both new releases, wires the executor and an MCP tool that callsformulation.IntrospectMethod.