Skip to content

Commit eea8f93

Browse files
committed
Allow nullable boolean pagination metadata for doc search
1 parent c04cb0c commit eea8f93

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

‎packages/cli/README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4682,8 +4682,11 @@ DESCRIPTION
46824682
"type": "object",
46834683
"properties": {
46844684
"hasNextPage": {
4685-
"type": "null",
4686-
"description": "The search endpoint does not provide pagination or completeness metadata."
4685+
"type": [
4686+
"boolean",
4687+
"null"
4688+
],
4689+
"description": "Whether more results are available, or null when unknown."
46874690
}
46884691
},
46894692
"required": [

‎packages/cli/oclif.manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6206,7 +6206,7 @@
62066206
],
62076207
"args": {
62086208
},
6209-
"description": "Query the shopify.dev vector store and print the most relevant documentation chunks as JSON. Best for programmatic discovery — surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`.\n\nUse `--json-schema` to print the result, error, and event schemas.\n\nOutput from `--json` conforms to the `DocSearchResult` schema.\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"results\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/DocumentationSearchEntry\"\n },\n \"description\": \"The top matching chunks from one search request.\"\n },\n \"pageInfo\": {\n \"$ref\": \"#/definitions/PageInfo\"\n }\n },\n \"required\": [\n \"results\",\n \"pageInfo\"\n ],\n \"additionalProperties\": false,\n \"title\": \"DocSearchResult\",\n \"definitions\": {\n \"DocumentationSearchEntry\": {\n \"type\": \"object\",\n \"properties\": {\n \"score\": {\n \"type\": \"number\",\n \"description\": \"The relevance score returned by shopify.dev.\"\n },\n \"content\": {\n \"type\": \"string\",\n \"description\": \"The matching documentation chunk.\"\n },\n \"url\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"The URL of the matching document.\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"The title of the matching document.\"\n },\n \"domain\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"The documentation domain, or null when unavailable.\"\n }\n },\n \"required\": [\n \"score\",\n \"content\",\n \"url\",\n \"title\",\n \"domain\"\n ],\n \"additionalProperties\": false\n },\n \"PageInfo\": {\n \"type\": \"object\",\n \"properties\": {\n \"hasNextPage\": {\n \"type\": \"null\",\n \"description\": \"The search endpoint does not provide pagination or completeness metadata.\"\n }\n },\n \"required\": [\n \"hasNextPage\"\n ],\n \"additionalProperties\": false\n }\n },\n \"$schema\": \"http://json-schema.org/draft-07/schema#\"\n}\n```",
6209+
"description": "Query the shopify.dev vector store and print the most relevant documentation chunks as JSON. Best for programmatic discovery — surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`.\n\nUse `--json-schema` to print the result, error, and event schemas.\n\nOutput from `--json` conforms to the `DocSearchResult` schema.\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"results\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/definitions/DocumentationSearchEntry\"\n },\n \"description\": \"The top matching chunks from one search request.\"\n },\n \"pageInfo\": {\n \"$ref\": \"#/definitions/PageInfo\"\n }\n },\n \"required\": [\n \"results\",\n \"pageInfo\"\n ],\n \"additionalProperties\": false,\n \"title\": \"DocSearchResult\",\n \"definitions\": {\n \"DocumentationSearchEntry\": {\n \"type\": \"object\",\n \"properties\": {\n \"score\": {\n \"type\": \"number\",\n \"description\": \"The relevance score returned by shopify.dev.\"\n },\n \"content\": {\n \"type\": \"string\",\n \"description\": \"The matching documentation chunk.\"\n },\n \"url\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"The URL of the matching document.\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"The title of the matching document.\"\n },\n \"domain\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"The documentation domain, or null when unavailable.\"\n }\n },\n \"required\": [\n \"score\",\n \"content\",\n \"url\",\n \"title\",\n \"domain\"\n ],\n \"additionalProperties\": false\n },\n \"PageInfo\": {\n \"type\": \"object\",\n \"properties\": {\n \"hasNextPage\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether more results are available, or null when unknown.\"\n }\n },\n \"required\": [\n \"hasNextPage\"\n ],\n \"additionalProperties\": false\n }\n },\n \"$schema\": \"http://json-schema.org/draft-07/schema#\"\n}\n```",
62106210
"descriptionWithMarkdown": "Query the shopify.dev vector store and print the most relevant documentation chunks as JSON. Best for programmatic discovery — surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`.",
62116211
"enableJsonFlag": false,
62126212
"examples": [

‎packages/cli/src/cli/services/commands/doc/types.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ describe('documentation JSON schemas', () => {
3131
expect(() => docFetchJsonOutputSchema.validate(result)).toThrow()
3232
})
3333

34-
test('encodes public search data, nullable domain, and unknown completeness', () => {
35-
const result = {results: [entry, {...entry, score: 0.99, domain: 'admin'}], pageInfo: {hasNextPage: null}}
34+
test.each([true, false, null])('encodes public search data with hasNextPage=%s', (hasNextPage) => {
35+
const result = {results: [entry, {...entry, score: 0.99, domain: 'admin'}], pageInfo: {hasNextPage}}
3636
expect(JSON.parse(docSearchJsonOutputSchema.encode(result))).toEqual(result)
37-
expect(JSON.parse(docSearchJsonOutputSchema.encode({results: [], pageInfo: {hasNextPage: null}}))).toEqual({
37+
expect(JSON.parse(docSearchJsonOutputSchema.encode({results: [], pageInfo: {hasNextPage}}))).toEqual({
3838
results: [],
39-
pageInfo: {hasNextPage: null},
39+
pageInfo: {hasNextPage},
4040
})
4141
})
4242

@@ -57,7 +57,7 @@ describe('documentation JSON schemas', () => {
5757
})
5858

5959
test.each([
60-
{results: [], pageInfo: {hasNextPage: false}},
60+
{results: [], pageInfo: {hasNextPage: 'unknown'}},
6161
{results: [], pageInfo: {hasNextPage: null, cursor: 'invented'}},
6262
{results: [], pageInfo: {hasNextPage: null}, body: '[]'},
6363
{invalidArray: []},

‎packages/cli/src/cli/services/commands/doc/types.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const documentationSearchEntrySchema = zod
3939

4040
const PageInfoSchema = zod
4141
.object({
42-
hasNextPage: zod.null().describe('The search endpoint does not provide pagination or completeness metadata.'),
42+
hasNextPage: zod.boolean().nullable().describe('Whether more results are available, or null when unknown.'),
4343
})
4444
.strict()
4545

0 commit comments

Comments
 (0)