Version 2.7.2. go version 1.26.6. runtime 1.4.2.
A natural migration from 2.6 -> 2.7.2 breaks for us.
Going from 2.6 to 2.7.2 introduced this: #2403 for our spec. The claimed fix is to upgrade the runtime to 1.4.2 https://github.com/oapi-codegen/oapi-codegen/issues/2403#issuecomment-4756703428.
Bumping the runtime to 1.4.2 then introduces response.union undefined for responses that utilize oneOf. I see numerous issues and questions lingering around this, so I'll not link them here. I would have expected a version bump for this lib just for this.
Chasing this down it looks like the first version it breaks on is 2.7.0. Similar reasons to other issues already opened.
Reproducible spec:
package: openapi
generate:
std-http-server: true
strict-server: true
models: true
embedded-spec: true
output-options:
skip-prune: true
openapi: 3.0.3
info:
title: repro
version: 1.0.0
paths:
/things:
get:
operationId: listThings
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Thing'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
components:
responses:
# This breaks: a *shared* (components/responses) response whose inline schema is a oneOf. Referenced from an operation via $ref.
BadRequest:
description: Invalid request
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Error'
- $ref: '#/components/schemas/ValidationError'
# Doesn't break: same shape, but a plain $ref schema. Generates fine.
NotFound:
description: Resource not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
Thing:
type: object
required: [id]
properties:
id:
type: string
Error:
type: object
required: [error, message]
properties:
error:
type: string
message:
type: string
ValidationError:
type: object
required: [error, message]
properties:
error:
type: string
message:
type: string
fields:
type: array
items:
type: string
Version 2.7.2. go version 1.26.6. runtime 1.4.2.
A natural migration from 2.6 -> 2.7.2 breaks for us.
Going from 2.6 to 2.7.2 introduced this: #2403 for our spec. The claimed fix is to upgrade the runtime to 1.4.2
https://github.com/oapi-codegen/oapi-codegen/issues/2403#issuecomment-4756703428.Bumping the runtime to 1.4.2 then introduces
response.union undefinedfor responses that utilizeoneOf. I see numerous issues and questions lingering around this, so I'll not link them here. I would have expected a version bump for this lib just for this.Chasing this down it looks like the first version it breaks on is 2.7.0. Similar reasons to other issues already opened.
Reproducible spec: