openapi-generator - 如何使用自定义响应类而不是使用spring默认的ResponseEntity
问题描述
我正在使用 openapi-generator-maven-plugin 生成类。使用以下依赖项
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.0.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${swagger.gen.product.componentsYaml}</inputSpec>
<generatorName>spring</generatorName>
<modelPackage>${swagger.gen.srcPackage}.model</modelPackage>
<apiPackage>${swagger.gen.srcPackage}.api.controller</apiPackage>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<sourceFolder>src/main/java</sourceFolder>
<java8>true</java8>
<dateLibrary>java8</dateLibrary>
</configOptions>
<verbose>true</verbose>
<generateSupportingFiles>true</generateSupportingFiles>
<generateApiTests>true</generateApiTests>
<generateModelTests>true</generateModelTests>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
</build>
生成的 java api 具有返回类型org.springframework.http.ResponseEntity
。
我想使用自定义响应类型,而不是使用默认响应类型。有什么方法可以实现吗?
解决方案
推荐阅读
- c++ - 是在堆上自动创建的特征矩阵吗?
- javascript - 模式未在 vue.js 中显示
- android - 尝试构建发布 apk 但收到 java.lang.OutOfMemoryError: GC 开销限制超出异常
- electron - 使用代码签名证书签署电子包时出错
- jenkins-groovy - 动态添加选择参数的 Groovy 代码
- reactjs - React 中类组件中的方法太多 - 问题重构
- python - 如何在不创建新生成器的情况下在 Python 中获取生成器的新输入
- javascript - Ionic 4 ion-datetime 浮动标签即使没有值也总是浮动
- python-3.x - Scrapy spider 只提取第一个表格元素
- android-studio - IDE未在颤动中显示小部件结束注释