oapi-codegen
oapi-codegen copied to clipboard
Client With Responses cant reference external responses
In the client-with-responses template if you have have
pkg b
components:
responses:
200:
description: "OK"
content:
'application/json':
schema:
$ref: '#/components/schemas/Document'
schemas:
Document:
type: object
properties:
fields:
type: object
additionalProperties:
$ref: '#/components/schemas/Value'
Value:
type: object
properties:
stringValue:
type: string
arrayValue:
$ref: '#/components/schemas/ArrayValue'
ArrayValue:
type: array
items:
$ref: '#/components/schemas/Value'
and in pkg a
paths:
/example:
get:
operationId: exampleGet
responses:
200:
$ref: "./pkgb/spec.yaml#/components/responses/200"
the codegen output doesnt include external refs

I will open a PR with a broken test to showcase an exact replica
pr that shows issue -> https://github.com/deepmap/oapi-codegen/pull/959
Proposed solution: #992
Issue is with the bump to kin-openapi v0.112.0 => V0.114.0
.
Schema struct is loaded
with Component
as nil
in new version.
In root schema yaml, I added a component property and schema is loaded properly into memory.
Generated models now have correct package.
fixed with #1013
Hey folks, mind re-reviewing this in light of the v2.1.0 release, which made some significant changes (:crossed_fingers: and the fix for this) to external references?