← back to Cli Printing Press
feat(cli): add GraphQLEndpointPath and EndpointTemplateVars to APISpec
73d136f732bbd012434458f37b9826dab60842c9 · 2026-04-29 20:41:07 -0500 · Cathryn Lavery
Splits the GraphQL endpoint path from the base URL on APISpec so the
generated client can target per-tenant or versioned endpoints
(e.g., https://{shop}/admin/api/{version}/graphql.json) instead of
hardcoding /graphql in the template.
EndpointTemplateVars is plumbing for PR-2 (env-var substitution); this
PR carries the field but does not wire runtime resolution yet.
REST specs leave GraphQLEndpointPath empty; GraphQL specs default it
to /graphql to preserve today's behavior. Subsequent commits update
the parsers and graphql_client template to consume the new fields.
Files touched
Diff
commit 73d136f732bbd012434458f37b9826dab60842c9
Author: Cathryn Lavery <50469282+cathrynlavery@users.noreply.github.com>
Date: Wed Apr 29 20:41:07 2026 -0500
feat(cli): add GraphQLEndpointPath and EndpointTemplateVars to APISpec
Splits the GraphQL endpoint path from the base URL on APISpec so the
generated client can target per-tenant or versioned endpoints
(e.g., https://{shop}/admin/api/{version}/graphql.json) instead of
hardcoding /graphql in the template.
EndpointTemplateVars is plumbing for PR-2 (env-var substitution); this
PR carries the field but does not wire runtime resolution yet.
REST specs leave GraphQLEndpointPath empty; GraphQL specs default it
to /graphql to preserve today's behavior. Subsequent commits update
the parsers and graphql_client template to consume the new fields.
---
internal/spec/spec.go | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/internal/spec/spec.go b/internal/spec/spec.go
index 73810b04..6b7f81e0 100644
--- a/internal/spec/spec.go
+++ b/internal/spec/spec.go
@@ -74,6 +74,20 @@ type APISpec struct {
Version string `yaml:"version" json:"version"`
BaseURL string `yaml:"base_url" json:"base_url"`
BasePath string `yaml:"base_path,omitempty" json:"base_path,omitempty"`
+ // GraphQLEndpointPath is the path appended to BaseURL for GraphQL POSTs.
+ // REST specs leave it empty; GraphQL specs default it to "/graphql" but
+ // can override (e.g., Shopify's "/admin/api/{version}/graphql.json").
+ // The split exists because some GraphQL APIs put the endpoint behind a
+ // per-tenant subdomain or version segment, and the old single-BaseURL
+ // model couldn't represent that without hardcoding "/graphql" in the
+ // generated client.
+ GraphQLEndpointPath string `yaml:"graphql_endpoint_path,omitempty" json:"graphql_endpoint_path,omitempty"`
+ // EndpointTemplateVars lists placeholder names embedded in BaseURL or
+ // GraphQLEndpointPath as {var} (e.g., ["shop", "version"]). The
+ // generator emits per-variable env-var lookups in the printed CLI's
+ // config so users can resolve them at runtime. PR-1 carries this field
+ // as plumbing only; PR-2 wires the runtime substitution.
+ EndpointTemplateVars []string `yaml:"endpoint_template_vars,omitempty" json:"endpoint_template_vars,omitempty"`
Owner string `yaml:"owner,omitempty" json:"owner,omitempty"` // GitHub owner for import paths and Homebrew tap
Kind string `yaml:"kind,omitempty" json:"kind,omitempty"` // "rest" (default) or "synthetic" — synthetic CLIs aggregate multiple sources beyond the spec; dogfood's path-validity check is relaxed accordingly
SpecSource string `yaml:"spec_source,omitempty" json:"spec_source,omitempty"` // official, community, sniffed, docs — affects generated client defaults
← d1b9cd27 fix(cli): mcp-sync auto-fixes spec.yaml name drift for inter
·
back to Cli Printing Press
·
feat(cli): split BaseURL from GraphQLEndpointPath in GraphQL 699e8ed7 →