You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
$ref in responses is not adding the imported reference properly #2113
openapi: 3.0.4components:
schemas:
ProblemDetails:
type: objectdescription: RFC 7807 Problem Detailsproperties:
type:
type: stringformat: uridescription: A URI reference that identifies the problem typetitle:
type: stringdescription: A short, human-readable summary of the problem typestatus:
type: integerdescription: The HTTP status coderequired: [title, status]responses:
StandardError:
description: Error response using RFC 7807 Problem Detailscontent:
application/problem+json:
schema:
$ref: "#/components/schemas/ProblemDetails"
Same issue here, I tried placing all of my request and response bodies in a common package. The generated code only references that package for schemas, not requests or responses:
externalRef0 "server-openapi/pkg/apigen/common"
type PostAuthLoginRequestObject struct {
Body *PostAuthLoginJSONRequestBody
}
should be:
type PostAuthLoginRequestObject struct {
Body *externalRef0.PostAuthLoginJSONRequestBody
}
I think I'm running into a similar problem.
I can't generate types (models) for anything that is referenced in another file, no matter if its responses or parameters etc.
Generating types if I have everything in the same file works fine.
It builds without errors though.
is import-mapping completely broken or is there some syntax wizardry that is needed?
Interesting. This works as you expect for numerical HTTP result codes, however, the strict server does something different for default, which is why it breaks.
Activity
tebruno99 commentedon Dec 7, 2025
Same issue here, I tried placing all of my request and response bodies in a common package. The generated code only references that package for schemas, not requests or responses:
externalRef0 "server-openapi/pkg/apigen/common"should be:
tebruno99 commentedon Dec 23, 2025
This only happens when the response in the import-mapping file references schema that is defined in the imported file.
descensus commentedon Dec 30, 2025
I think I'm running into a similar problem.
I can't generate types (models) for anything that is referenced in another file, no matter if its responses or parameters etc.
Generating types if I have everything in the same file works fine.
It builds without errors though.
is import-mapping completely broken or is there some syntax wizardry that is needed?
Can't even get https://github.com/oapi-codegen/oapi-codegen/tree/main/examples/import-mapping to work though
Running v2.5.1 on MacOS.
Tried earlier versions as well, no diff.
mromaszewicz commentedon Feb 24, 2026
Interesting. This works as you expect for numerical HTTP result codes, however, the strict server does something different for
default, which is why it breaks.fix: qualify external ref schema types in default response codes
fix: qualify external ref schema types in default response codes (oap…