Files
Trevin Chow fb164adc55 feat(cli): per-endpoint header routing and auth inference from Authorization header params (#136)
Two OpenAPI parser improvements:

1. Per-endpoint header routing: when a required header (e.g., cal-api-version) has
   different values across endpoint groups, each generated command sends the correct
   value. Global RequiredHeaders use the majority value as default; endpoints with
   different values get HeaderOverrides. Client template supports WithHeaders variants
   for all HTTP methods.

2. Auth inference tier 4: when securitySchemes, query-param inference, and description
   inference all fail, scans operations for required Authorization header parameters.
   If found on >30% of operations, infers Bearer auth. Catches APIs like Cal.com that
   declare auth via individual header params instead of securitySchemes.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 18:14:07 -07:00

114 lines
2.5 KiB
YAML

openapi: "3.0.0"
info:
title: Multi Version Header API
version: "1.0.0"
description: "API with per-endpoint version headers"
servers:
- url: https://api.example.com
security:
- BearerAuth: []
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
paths:
/v2/bookings:
get:
operationId: listBookings
summary: List bookings
parameters:
- name: cal-api-version
in: header
required: true
schema:
type: string
default: "2024-08-13"
responses:
"200":
description: OK
/v2/bookings/{id}:
get:
operationId: getBooking
summary: Get a booking
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: cal-api-version
in: header
required: true
schema:
type: string
default: "2024-08-13"
responses:
"200":
description: OK
/v2/event-types:
get:
operationId: listEventTypes
summary: List event types
parameters:
- name: cal-api-version
in: header
required: true
schema:
type: string
default: "2024-06-14"
responses:
"200":
description: OK
/v2/event-types/{id}:
get:
operationId: getEventType
summary: Get an event type
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: cal-api-version
in: header
required: true
schema:
type: string
default: "2024-06-14"
responses:
"200":
description: OK
patch:
operationId: updateEventType
summary: Update event type
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: cal-api-version
in: header
required: true
schema:
type: string
default: "2024-06-14"
responses:
"200":
description: OK
/v2/schedules:
get:
operationId: listSchedules
summary: List schedules
parameters:
- name: cal-api-version
in: header
required: true
schema:
type: string
default: "2024-08-13"
responses:
"200":
description: OK