openapi-code-generator 3.3.4 不会读取标签,并且不需要 API 类名



我在下面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设置为trueopenapi-generator-maven-pluginconfigOptions部分中

默认情况下,useTags设置为 false,因此它不会使用标签名称来创建 API 类名称。

<configOptions>
  <sourceFolder>openapi</sourceFolder>
  <interfaceOnly>true</interfaceOnly>
  <useBeanValidation>true</useBeanValidation>
  <dateLibrary>java8-localdatetime</dateLibrary>
  <useTags>true</useTags>
</configOptions>

相关内容

最新更新