提问人:ogbofjnr 提问时间:10/5/2023 更新时间:10/5/2023 访问量:63
如何使用 ref 从 OpenAPI 生成模型
How to generate models from OpenAPI with ref
问:
我有一个文件,其中引用了此文件夹中的其他文件:
$ref: "./inbound_api.yaml#/components/schemas/BadRequestResponse"
当我跑步时
oapi-codegen -generate types -o pkg/models/inbound/booking.go -package models booking.yaml
它无法解析文件
error generating code: error creating operation definitions: error generating response definitions: error generating request body definition: error turning reference (./inbound_api.yaml#/components/schemas/Response) into a Go type: unrecognized external reference './inbound_api.yaml'; please provide the known import for this reference using option --import-mapping
如何提供映射?我需要对同一文件夹中的文件执行此操作吗?
答: 暂无答案
评论