Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/openapi/src/core/normalize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ describe('normalize', () => {
expect(ir.operations[0]?.responses[0]?.contentType).toBe('application/json');
});

it('keeps trace operations instead of silently dropping them', () => {
const ir = normalize({
openapi: '3.0.0',
info: { title: 'Trace', version: '1' },
paths: {
'/debug': { trace: { operationId: 'traceDebug', responses: { '200': { description: 'ok' } } } },
},
});
expect(ir.operations).toHaveLength(1);
expect(ir.operations[0]?.method).toBe('trace');
expect(ir.operations[0]?.id).toBe('traceDebug');
});

it('auto-generates operationId when missing', () => {
const ir = normalize({
openapi: '3.0.0',
Expand Down
4 changes: 3 additions & 1 deletion packages/openapi/src/core/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import type {
SecurityScheme,
} from './types.js';

const METHODS: HttpMethod[] = ['get', 'post', 'put', 'delete', 'patch', 'head', 'options'];
// `trace` is part of the OpenAPI 3 Operations Object — without it, trace
// operations are silently dropped from the IR and every generator output.
const METHODS: HttpMethod[] = ['get', 'post', 'put', 'delete', 'patch', 'head', 'options', 'trace'];

// Walks a parsed OpenAPI 3.x document and produces our internal IR.
// $ref resolution is intentionally shallow: we only resolve refs that point
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// keep JSON Schema as a pass-through `unknown` to avoid reimplementing it;
// generators that need richer typing can walk it themselves.

export type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options';
export type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options' | 'trace';

export interface Parameter {
name: string;
Expand Down
Loading