[object Object]

← back to Cli Printing Press

fix(cli): raise resource limit from 50 to 500 and add --max-resources flag (#152)

b1128d0e07fd54a217a556233293a1daf2fd35a5 · 2026-04-09 07:54:12 -0700 · Matt Van Horn

The hardcoded 50-resource cap silently dropped endpoints for large APIs
like Slack (174 endpoints, 25+ resource groups). Alphabetical ordering
meant admin.* endpoints filled all 50 slots and user-facing endpoints
(chat, conversations, users, search) were skipped entirely.

Raises the default to 500 (accommodates all known APIs) and adds a
--max-resources flag mirroring the existing --max-endpoints-per-resource
pattern for explicit override.

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit b1128d0e07fd54a217a556233293a1daf2fd35a5
Author: Matt Van Horn <mvanhorn@users.noreply.github.com>
Date:   Thu Apr 9 07:54:12 2026 -0700

    fix(cli): raise resource limit from 50 to 500 and add --max-resources flag (#152)
    
    The hardcoded 50-resource cap silently dropped endpoints for large APIs
    like Slack (174 endpoints, 25+ resource groups). Alphabetical ordering
    meant admin.* endpoints filled all 50 slots and user-facing endpoints
    (chat, conversations, users, search) were skipped entirely.
    
    Raises the default to 500 (accommodates all known APIs) and adds a
    --max-resources flag mirroring the existing --max-endpoints-per-resource
    pattern for explicit override.
    
    Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
    Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---
 internal/cli/root.go       |  5 +++++
 internal/openapi/parser.go | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/internal/cli/root.go b/internal/cli/root.go
index 1e5d55fb..e4c20bb3 100644
--- a/internal/cli/root.go
+++ b/internal/cli/root.go
@@ -74,6 +74,7 @@ func newGenerateCmd() *cobra.Command {
 	var clientPattern string
 	var researchDir string
 	var maxEndpointsPerResource int
+	var maxResources int
 	var specURL string
 
 	cmd := &cobra.Command{
@@ -215,6 +216,9 @@ func newGenerateCmd() *cobra.Command {
 				return &ExitError{Code: ExitInputError, Err: fmt.Errorf("--spec is required")}
 			}
 
+			if maxResources > 0 {
+				openapi.SetMaxResources(maxResources)
+			}
 			if maxEndpointsPerResource > 0 {
 				openapi.SetMaxEndpointsPerResource(maxEndpointsPerResource)
 			}
@@ -389,6 +393,7 @@ func newGenerateCmd() *cobra.Command {
 	cmd.Flags().StringVar(&specSource, "spec-source", "", "Spec provenance: official, community, sniffed, docs (affects generated client defaults like rate limiting)")
 	cmd.Flags().StringVar(&clientPattern, "client-pattern", "", "HTTP client pattern: rest (default), proxy-envelope (wraps requests in POST envelope)")
 	cmd.Flags().StringVar(&researchDir, "research-dir", "", "Pipeline directory containing research.json and discovery/ for README source credits")
+	cmd.Flags().IntVar(&maxResources, "max-resources", 0, "Maximum resource groups to generate (default 500, raise for enormous APIs)")
 	cmd.Flags().IntVar(&maxEndpointsPerResource, "max-endpoints-per-resource", 0, "Maximum endpoints per resource (default 50, raise for large APIs)")
 	cmd.Flags().StringVar(&specURL, "spec-url", "", "Original spec URL for provenance (use when --spec is a local file downloaded from a URL)")
 
diff --git a/internal/openapi/parser.go b/internal/openapi/parser.go
index e71e9d3e..6c0ed334 100644
--- a/internal/openapi/parser.go
+++ b/internal/openapi/parser.go
@@ -19,11 +19,21 @@ import (
 )
 
 var (
-	maxResources            = 50
+	maxResources            = 500
 	maxEndpointsPerResource = 50
 	endpointLimitExplicit   = false // true when user set --max-endpoints-per-resource
+	resourceLimitExplicit   = false // true when user set --max-resources
 )
 
+// SetMaxResources overrides the default resource limit. When not called,
+// the parser uses a default of 500 which accommodates all known APIs.
+func SetMaxResources(n int) {
+	if n > 0 {
+		maxResources = n
+		resourceLimitExplicit = true
+	}
+}
+
 // SetMaxEndpointsPerResource overrides the default limit and disables
 // auto-calibration. When not called, the parser auto-calibrates the limit
 // from the spec so well-formed specs never have endpoints silently skipped.

← 816a9fd6 fix(cli): deduplicate config env var tags and add operations  ·  back to Cli Printing Press  ·  fix(skills): constrain artifact writes to managed directorie 178ae829 →