Skip to content

Commit 9d63939

Browse files
author
stlc-bot
committed
fix(api): derive OpenAPI request docs from runtime Zod schemas (#1421)
Stainless-Generated-From: dcaa0d58f6d6520bde41b322dbade51f950e35b7
1 parent d1cd151 commit 9d63939

7 files changed

Lines changed: 37 additions & 34 deletions

File tree

‎pkg/cmd/batch.go‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var batchList = cli.Command{
4343
&requestflag.Flag[int64]{
4444
Name: "limit",
4545
Usage: "Batches per page. Defaults to 25.",
46+
Default: 25,
4647
QueryPath: "limit",
4748
},
4849
&requestflag.Flag[string]{
@@ -60,9 +61,9 @@ var batchList = cli.Command{
6061
Usage: "Filter by status.",
6162
QueryPath: "status",
6263
},
63-
&requestflag.Flag[string]{
64+
&requestflag.Flag[any]{
6465
Name: "tags",
65-
Usage: "Comma-separated list of tags to filter by (matches batches having any of them).",
66+
Usage: "Tags to filter by (matches batches having any of them). Pass repeated `tags` params or one comma-separated list, e.g. `tags=docs,competitor`.",
6667
QueryPath: "tags",
6768
},
6869
},
@@ -121,6 +122,7 @@ var batchGetResults = cli.Command{
121122
&requestflag.Flag[int64]{
122123
Name: "limit",
123124
Usage: "Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records.",
125+
Default: 25,
124126
QueryPath: "limit",
125127
},
126128
},

‎pkg/cmd/batch_test.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestBatchGetResults(t *testing.T) {
7070
"--api-key", "string",
7171
"batch", "get-results",
7272
"--batch-id", "batch_9f2c8a",
73-
"--cursor", "cursor",
73+
"--cursor", "321669910225:155771193",
7474
"--limit", "1",
7575
)
7676
})
@@ -87,7 +87,7 @@ func TestBatchSubmit(t *testing.T) {
8787
"--tag", "docs",
8888
"--tag", "competitor",
8989
"--webhook", "{url: https://example.com, retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}",
90-
"--webhook-url", "webhookUrl",
90+
"--webhook-url", "https://example.com",
9191
"--idempotency-key", "Idempotency-Key",
9292
)
9393
})
@@ -106,7 +106,7 @@ func TestBatchSubmit(t *testing.T) {
106106
"--tag", "competitor",
107107
"--webhook.url", "https://example.com",
108108
"--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}",
109-
"--webhook-url", "webhookUrl",
109+
"--webhook-url", "https://example.com",
110110
"--idempotency-key", "Idempotency-Key",
111111
)
112112
})
@@ -160,7 +160,7 @@ func TestBatchSubmit(t *testing.T) {
160160
" - 7200\n" +
161161
" - 21600\n" +
162162
" - 57600\n" +
163-
"webhookUrl: webhookUrl\n")
163+
"webhookUrl: https://example.com\n")
164164
mocktest.TestRunMockTestWithPipeAndFlags(
165165
t, pipeData,
166166
"--api-key", "string",

‎pkg/cmd/brand.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{
6262
},
6363
&requestflag.Flag[string]{
6464
Name: "country-gl",
65-
Usage: "Optional country code hint (GL parameter) to specify the country when looking up by company name.",
65+
Usage: "Two-letter ISO 3166-1 alpha-2 country code (GL parameter) used to localize search.",
6666
BodyPath: "country_gl",
6767
},
6868
&requestflag.Flag[string]{
@@ -77,7 +77,7 @@ var brandRetrieve = requestflag.WithInnerFlags(cli.Command{
7777
},
7878
&requestflag.Flag[string]{
7979
Name: "ticker-exchange",
80-
Usage: "Optional stock exchange for the ticker. Defaults to NASDAQ if not specified.",
80+
Usage: "Stock exchange code.",
8181
BodyPath: "ticker_exchange",
8282
},
8383
&requestflag.Flag[string]{

‎pkg/cmd/parse.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ var parseHandle = requestflag.WithInnerFlags(cli.Command{
9090
"pdf": {
9191
&requestflag.InnerFlag[int64]{
9292
Name: "pdf.end",
93-
Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.",
93+
Usage: "Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must be >= start.",
9494
InnerField: "end",
9595
},
9696
&requestflag.InnerFlag[int64]{
9797
Name: "pdf.start",
98-
Usage: "First 1-based PDF page to parse. When omitted, parsing starts at the first page.",
98+
Usage: "First 1-based PDF page to parse.",
9999
InnerField: "start",
100100
},
101101
},

‎pkg/cmd/web.go‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,14 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{
405405
Usage: "Keep hyperlinks in the Markdown.",
406406
InnerField: "includeLinks",
407407
},
408-
&requestflag.InnerFlag[int64]{
408+
&requestflag.InnerFlag[*int64]{
409409
Name: "markdown-options.max-age-ms",
410410
Usage: "Maximum cache age in milliseconds for result page content. Defaults to 180 days (15552000000 ms) when Markdown is requested, or 365 days (31536000000 ms) when only highlights are requested. Explicit values override either default. Maximum: 365 days. Set to 0 to force a fresh scrape.",
411411
InnerField: "maxAgeMs",
412412
},
413413
&requestflag.InnerFlag[map[string]any]{
414414
Name: "markdown-options.pdf",
415-
Usage: "PDF handling. Use start/end to bound text extraction and OCR to a page range.",
415+
Usage: "PDF handling. `start`/`end` limit parsing to an inclusive, 1-based page range.",
416416
InnerField: "pdf",
417417
},
418418
&requestflag.InnerFlag[bool]{
@@ -430,7 +430,7 @@ var webSearch = requestflag.WithInnerFlags(cli.Command{
430430
Usage: "Strip nav, header, footer, and sidebar — keep only the primary article content.",
431431
InnerField: "useMainContentOnly",
432432
},
433-
&requestflag.InnerFlag[int64]{
433+
&requestflag.InnerFlag[*int64]{
434434
Name: "markdown-options.wait-for-ms",
435435
Usage: "Extra wait after page load before rendering, in ms (0–30000). Useful for JS-heavy pages.",
436436
InnerField: "waitForMs",
@@ -466,7 +466,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{
466466
Usage: "Fetch from this country (ISO 3166-1 alpha-2).",
467467
BodyPath: "country",
468468
},
469-
&requestflag.Flag[[]string]{
469+
&requestflag.Flag[any]{
470470
Name: "exclude-selector",
471471
Usage: "Remove matching elements after inclusions. Exclusions take precedence.",
472472
BodyPath: "excludeSelectors",
@@ -495,15 +495,15 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{
495495
Default: true,
496496
BodyPath: "includeLinks",
497497
},
498-
&requestflag.Flag[[]string]{
498+
&requestflag.Flag[any]{
499499
Name: "include-selector",
500500
Usage: "Keep matching HTML subtrees before converting each page to Markdown.",
501501
BodyPath: "includeSelectors",
502502
},
503-
&requestflag.Flag[int64]{
503+
&requestflag.Flag[*int64]{
504504
Name: "max-age-ms",
505505
Usage: "Maximum cache age in milliseconds. Defaults to 1 day; `0` fetches fresh.",
506-
Default: 86400000,
506+
Default: requestflag.Ptr[int64](86400000),
507507
BodyPath: "maxAgeMs",
508508
},
509509
&requestflag.Flag[int64]{
@@ -562,10 +562,10 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{
562562
Default: false,
563563
BodyPath: "useMainContentOnly",
564564
},
565-
&requestflag.Flag[int64]{
565+
&requestflag.Flag[*int64]{
566566
Name: "wait-for-ms",
567567
Usage: "Browser wait time in milliseconds after initial page load for each crawled page. Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds).",
568-
Default: 3500,
568+
Default: requestflag.Ptr[int64](3500),
569569
BodyPath: "waitForMs",
570570
},
571571
&requestflag.Flag[string]{
@@ -581,12 +581,12 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{
581581
"pdf": {
582582
&requestflag.InnerFlag[int64]{
583583
Name: "pdf.end",
584-
Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.",
584+
Usage: "Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must be >= start.",
585585
InnerField: "end",
586586
},
587587
&requestflag.InnerFlag[bool]{
588588
Name: "pdf.ocr",
589-
Usage: "Read scanned PDF pages with OCR; preserve pages that already contain text.",
589+
Usage: "Read scanned PDF pages with OCR; preserve pages that already have text.",
590590
InnerField: "ocr",
591591
},
592592
&requestflag.InnerFlag[bool]{
@@ -596,7 +596,7 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{
596596
},
597597
&requestflag.InnerFlag[int64]{
598598
Name: "pdf.start",
599-
Usage: "First 1-based PDF page to parse. When omitted, parsing starts at the first page.",
599+
Usage: "First 1-based PDF page to parse.",
600600
InnerField: "start",
601601
},
602602
},

‎pkg/cmd/web_test.go‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,10 @@ func TestWebSearch(t *testing.T) {
213213
"web", "search",
214214
"--query", "Stripe API authentication",
215215
"--country", "af",
216-
"--exclude-domain", "string",
216+
"--exclude-domain", "xxx",
217217
"--freshness", "last_24_hours",
218218
"--highlights-options", "{enabled: true, maxCharacters: 100}",
219-
"--include-domain", "string",
219+
"--include-domain", "xxx",
220220
"--markdown-options", "{enabled: true, includeFrames: true, includeImages: true, includeLinks: true, maxAgeMs: 0, pdf: {end: 1, shouldParse: true, start: 1}, shortenBase64Images: true, timeoutOpts: {milliseconds: 1, behavior: fail}, useMainContentOnly: true, waitForMs: 0}",
221221
"--num-results", "10",
222222
"--query-fanout=true",
@@ -238,11 +238,11 @@ func TestWebSearch(t *testing.T) {
238238
"web", "search",
239239
"--query", "Stripe API authentication",
240240
"--country", "af",
241-
"--exclude-domain", "string",
241+
"--exclude-domain", "xxx",
242242
"--freshness", "last_24_hours",
243243
"--highlights-options.enabled=true",
244244
"--highlights-options.max-characters", "100",
245-
"--include-domain", "string",
245+
"--include-domain", "xxx",
246246
"--markdown-options.enabled=true",
247247
"--markdown-options.include-frames=true",
248248
"--markdown-options.include-images=true",
@@ -269,13 +269,13 @@ func TestWebSearch(t *testing.T) {
269269
"query: Stripe API authentication\n" +
270270
"country: af\n" +
271271
"excludeDomains:\n" +
272-
" - string\n" +
272+
" - xxx\n" +
273273
"freshness: last_24_hours\n" +
274274
"highlightsOptions:\n" +
275275
" enabled: true\n" +
276276
" maxCharacters: 100\n" +
277277
"includeDomains:\n" +
278-
" - string\n" +
278+
" - xxx\n" +
279279
"markdownOptions:\n" +
280280
" enabled: true\n" +
281281
" includeFrames: true\n" +
@@ -318,12 +318,12 @@ func TestWebWebCrawlMd(t *testing.T) {
318318
"web", "web-crawl-md",
319319
"--url", "https://example.com",
320320
"--country", "de",
321-
"--exclude-selector", "string",
321+
"--exclude-selector", "[x]",
322322
"--follow-subdomains=true",
323323
"--include-frames=true",
324324
"--include-images=true",
325325
"--include-links=true",
326-
"--include-selector", "string",
326+
"--include-selector", "[x]",
327327
"--max-age-ms", "0",
328328
"--max-depth", "0",
329329
"--max-pages", "10",
@@ -352,12 +352,12 @@ func TestWebWebCrawlMd(t *testing.T) {
352352
"web", "web-crawl-md",
353353
"--url", "https://example.com",
354354
"--country", "de",
355-
"--exclude-selector", "string",
355+
"--exclude-selector", "[x]",
356356
"--follow-subdomains=true",
357357
"--include-frames=true",
358358
"--include-images=true",
359359
"--include-links=true",
360-
"--include-selector", "string",
360+
"--include-selector", "[x]",
361361
"--max-age-ms", "0",
362362
"--max-depth", "0",
363363
"--max-pages", "10",
@@ -385,13 +385,13 @@ func TestWebWebCrawlMd(t *testing.T) {
385385
"url: https://example.com\n" +
386386
"country: de\n" +
387387
"excludeSelectors:\n" +
388-
" - string\n" +
388+
" - x\n" +
389389
"followSubdomains: true\n" +
390390
"includeFrames: true\n" +
391391
"includeImages: true\n" +
392392
"includeLinks: true\n" +
393393
"includeSelectors:\n" +
394-
" - string\n" +
394+
" - x\n" +
395395
"maxAgeMs: 0\n" +
396396
"maxDepth: 0\n" +
397397
"maxPages: 10\n" +

‎pkg/cmd/webhookdelivery.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ var webhooksDeliveriesRetry = cli.Command{
138138
&requestflag.Flag[bool]{
139139
Name: "force",
140140
Usage: "Resend even if the delivery already succeeded. Defaults to false.",
141+
Default: false,
141142
BodyPath: "force",
142143
},
143144
&requestflag.Flag[[]string]{

0 commit comments

Comments
 (0)