我在下面openapi
文档。我希望生成的 API 类名将被SampleApi
,因为操作"/hello"被标记为"sample" tags
.但它正在使用operation
名称生成 API 类名,它是 HelloApi
.我在这里错过了什么?我正在使用openapi-generator-maven-plugin
版本3.3.1
openapi: "3.0.0"
info:
version: 1.0.0
title: Sample Service
tags:
- name: sample
paths:
/hello:
get:
summary: Says hello world
operationId: greet
tags:
- sample
responses:
200:
description: ok
content:
plain/text:
schema:
type: string
example: Hello World
我找到了解决方案。我们需要使用选项useTags
设置为true
在openapi-generator-maven-plugin
的configOptions
部分中
默认情况下,useTags
设置为 false
,因此它不会使用标签名称来创建 API 类名称。
<configOptions>
<sourceFolder>openapi</sourceFolder>
<interfaceOnly>true</interfaceOnly>
<useBeanValidation>true</useBeanValidation>
<dateLibrary>java8-localdatetime</dateLibrary>
<useTags>true</useTags>
</configOptions>