forked from ogen-go/ogen
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Many real-world APIs use wildcard content types like */* or application/* in their OpenAPI specs to indicate they accept/return any content type (typically JSON). ogen currently fails with "unsupported content type" error.
Specs Affected
- carriers/jitsu/specs/openapi.yaml (14 occurrences of
*/*) - carriers/nshift/specs/openapi.yaml (3 occurrences of
*/*)
Current Error
Content type "*/*" is unsupported.
Try to create ogen.yml with:
generator:
ignore_not_implemented: ["unsupported content types"]
to skip unsupported operations.
Example OpenAPI Spec
paths:
/shipments:
post:
operationId: createShipment
requestBody:
required: true
content:
'*/*': # Wildcard content type
schema:
$ref: '#/components/schemas/Shipment'
responses:
'201':
description: Shipment created
content:
'*/*':
schema:
$ref: '#/components/schemas/Shipment'Minimal Reproduction
openapi: 3.0.1
info:
title: Wildcard Content Type Test
version: 1.0.0
paths:
/test:
post:
operationId: testWildcard
requestBody:
required: true
content:
'*/*':
schema:
type: object
properties:
name:
type: string
responses:
'200':
description: Success
content:
'*/*':
schema:
type: object
properties:
id:
type: stringTest: ogen --target /tmp/test --clean test.yaml
Proposed Solution
Add content type mapping in ogen.yml:
generator:
content_types:
# Map wildcard to specific type
'*/*': 'application/json'
'application/*': 'application/json'Or implement automatic fallback:
- If both request and response use
*/*→ assumeapplication/json - If mixed (one
*/*, one specific) → use the specific type - Allow users to configure preferred fallback type
Expected
Map */* to a specific content type (preferably application/json by default)
Actual
Generation fails unless operation is skipped via ignore_not_implemented
Impact
- Cannot generate clients for ~15% of real-world carrier/logistics APIs
- Workaround requires skipping entire operations, losing API coverage
OpenAPI Spec Reference
The OpenAPI 3.x spec allows wildcards in media types: https://spec.openapis.org/oas/v3.0.3#media-type-object
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request