Sri*_*har 2 java java-8 openapi-generator
我有以下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在configOptions的部分openapi-generator-maven-plugin
默认useTags设置为false所以它不会使用标签名称来创建 API 类名称。
<configOptions>
<sourceFolder>openapi</sourceFolder>
<interfaceOnly>true</interfaceOnly>
<useBeanValidation>true</useBeanValidation>
<dateLibrary>java8-localdatetime</dateLibrary>
<useTags>true</useTags>
</configOptions>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1245 次 |
| 最近记录: |