From 1a78042bd6eba2c402a8f508a1a53d75579b2efb Mon Sep 17 00:00:00 2001 From: sykosyber Date: Mon, 12 Oct 2026 16:10:27 -0700 Subject: [PATCH 1/3] Compiler: leave out an optional compound query or header parameter An optional array or object query/header parameter used to refuse the whole operation. It is now left out of the inputs, and the operation compiles: it works without that parameter (Google Calendar's events.list and eventTypes). A required compound parameter still refuses the operation. Co-Authored-By: Claude Opus 5.5 --- .../capabilities/compoundParameters.test.ts | 41 +++++++++++++++++++ src/core/capabilities/openapi.ts | 3 ++ 2 files changed, 44 insertions(+) create mode 100644 src/core/capabilities/compoundParameters.test.ts diff --git a/src/core/capabilities/compoundParameters.test.ts b/src/core/capabilities/compoundParameters.test.ts new file mode 100644 index 0000000..3e99872 --- /dev/null +++ b/src/core/capabilities/compoundParameters.test.ts @@ -0,0 +1,41 @@ +import { describe, expect, it } from 'vitest'; +import { compileOpenApi } from './openapi'; + +function spec(parameter: Record) { + return { + openapi: '3.0.3', + info: { title: 'Events', version: '1' }, + servers: [{ url: 'https://events.example.test' }], + paths: { + '/events': { + get: { + operationId: 'events.list', + parameters: [ + { name: 'q', in: 'query', schema: { type: 'string' } }, + parameter + ], + responses: { '200': { description: 'ok', content: { 'application/json': { schema: { type: 'array', items: { type: 'string' } } } } } } + } + } + } + }; +} + +describe('compound query and header parameters', () => { + it('leaves an optional array parameter out, and keeps the operation', () => { + const { manifests, errors } = compileOpenApi(spec({ name: 'eventTypes', in: 'query', style: 'form', explode: true, schema: { type: 'array', items: { type: 'string' } } })); + expect(errors).toEqual([]); + expect(manifests[0].inputs.map(input => input.name)).toEqual(['q']); + }); + + it('leaves an optional object header out', () => { + const { manifests } = compileOpenApi(spec({ name: 'X-Filter', in: 'header', schema: { type: 'object', properties: { a: { type: 'string' } } } })); + expect(manifests[0].inputs.map(input => input.name)).toEqual(['q']); + }); + + it('still refuses an operation whose required parameter is compound', () => { + const { manifests, errors } = compileOpenApi(spec({ name: 'ids', in: 'query', required: true, schema: { type: 'array', items: { type: 'string' } } })); + expect(manifests).toEqual([]); + expect(errors[0].message).toBe('ids: compound query parameters are outside the supported subset'); + }); +}); diff --git a/src/core/capabilities/openapi.ts b/src/core/capabilities/openapi.ts index 95189c2..40c5d14 100644 --- a/src/core/capabilities/openapi.ts +++ b/src/core/capabilities/openapi.ts @@ -400,6 +400,9 @@ function collectInputs( const converted = fromJsonSchema(isRecord(parameter.schema) || Array.isArray(parameter.schema) ? parameter.schema : { type: 'string' }, spec); if (!converted.ok) return { error: `${String(parameter.name)}: ${converted.error}` }; if ((location === 'query' || location === 'header') && (converted.schema.kind === 'object' || converted.schema.kind === 'array')) { + // An optional one can be left out: the operation still works + // without it (Google Calendar's events.list and its eventTypes). + if (parameter.required !== true) continue; return { error: `${String(parameter.name)}: compound ${location} parameters are outside the supported subset` }; } const name = String(parameter.name); From 4f34c68c7ddf47b0950e3d83975c028bed989c71 Mon Sep 17 00:00:00 2001 From: sykosyber Date: Mon, 12 Oct 2026 16:13:12 -0700 Subject: [PATCH 2/3] Codex: leave out optional compound parameters only on reads Co-Authored-By: Claude Opus 5.5 --- src/core/capabilities/compoundParameters.test.ts | 10 ++++++++-- src/core/capabilities/openapi.ts | 7 ++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/core/capabilities/compoundParameters.test.ts b/src/core/capabilities/compoundParameters.test.ts index 3e99872..ec35e54 100644 --- a/src/core/capabilities/compoundParameters.test.ts +++ b/src/core/capabilities/compoundParameters.test.ts @@ -1,14 +1,14 @@ import { describe, expect, it } from 'vitest'; import { compileOpenApi } from './openapi'; -function spec(parameter: Record) { +function spec(parameter: Record, method = 'get') { return { openapi: '3.0.3', info: { title: 'Events', version: '1' }, servers: [{ url: 'https://events.example.test' }], paths: { '/events': { - get: { + [method]: { operationId: 'events.list', parameters: [ { name: 'q', in: 'query', schema: { type: 'string' } }, @@ -33,6 +33,12 @@ describe('compound query and header parameters', () => { expect(manifests[0].inputs.map(input => input.name)).toEqual(['q']); }); + it('still refuses a write with an optional compound parameter', () => { + const { manifests, errors } = compileOpenApi(spec({ name: 'tags', in: 'query', schema: { type: 'array', items: { type: 'string' } } }, 'post')); + expect(manifests).toEqual([]); + expect(errors[0].message).toBe('tags: compound query parameters are outside the supported subset'); + }); + it('still refuses an operation whose required parameter is compound', () => { const { manifests, errors } = compileOpenApi(spec({ name: 'ids', in: 'query', required: true, schema: { type: 'array', items: { type: 'string' } } })); expect(manifests).toEqual([]); diff --git a/src/core/capabilities/openapi.ts b/src/core/capabilities/openapi.ts index 40c5d14..6df5c29 100644 --- a/src/core/capabilities/openapi.ts +++ b/src/core/capabilities/openapi.ts @@ -400,9 +400,10 @@ function collectInputs( const converted = fromJsonSchema(isRecord(parameter.schema) || Array.isArray(parameter.schema) ? parameter.schema : { type: 'string' }, spec); if (!converted.ok) return { error: `${String(parameter.name)}: ${converted.error}` }; if ((location === 'query' || location === 'header') && (converted.schema.kind === 'object' || converted.schema.kind === 'array')) { - // An optional one can be left out: the operation still works - // without it (Google Calendar's events.list and its eventTypes). - if (parameter.required !== true) continue; + // An optional one can be left out of a read: the operation still + // works without it (Google Calendar's events.list and eventTypes). + // Not of a write, which would add write surface (AGENTS.md stop condition 3). + if (parameter.required !== true && (method === 'GET' || method === 'HEAD')) continue; return { error: `${String(parameter.name)}: compound ${location} parameters are outside the supported subset` }; } const name = String(parameter.name); From 14b738f8126ccd65359484dbf41b23819e326339 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Mon, 12 Oct 2026 23:13:36 +0000 Subject: [PATCH 3/3] Codex: skip optional compound params only on read operations, before conversion failure Co-Authored-By: Claude Sonnet 5.5 --- src/core/capabilities/openapi.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/capabilities/openapi.ts b/src/core/capabilities/openapi.ts index 6df5c29..1833b7f 100644 --- a/src/core/capabilities/openapi.ts +++ b/src/core/capabilities/openapi.ts @@ -398,6 +398,10 @@ function collectInputs( return { error: `parameter location ${String(location)} is unsupported` }; } const converted = fromJsonSchema(isRecord(parameter.schema) || Array.isArray(parameter.schema) ? parameter.schema : { type: 'string' }, spec); + const rawSchema = deref(spec, parameter.schema); + const rawCompound = isRecord(rawSchema) && (rawSchema.type === 'array' || rawSchema.type === 'object'); + const readOnly = method === 'GET' || method === 'HEAD'; + if (!converted.ok && readOnly && location !== 'path' && parameter.required !== true && rawCompound) continue; if (!converted.ok) return { error: `${String(parameter.name)}: ${converted.error}` }; if ((location === 'query' || location === 'header') && (converted.schema.kind === 'object' || converted.schema.kind === 'array')) { // An optional one can be left out of a read: the operation still