我正在使用 4.2.3 版本的 openapi-generator-maven-plugin 。
我的配置如下:
<typeMappings>
<typeMapping>OffsetDate=LocalDate</typeMapping>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDate=java.time.LocalDate</importMapping>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
<!-- pass any necessary config options -->
<configOptions>
<java8>true</java8>
<skipDefaultInterface>true</skipDefaultInterface>
<dateLibrary>java8</dateLibrary>
<interfaceOnly>true</interfaceOnly>
<swaggerDocketConfig>false</swaggerDocketConfig>
<hateoas>true</hateoas>
</configOptions>
在 ma yaml 中,我使用示例参数定义了我的属性:
myDate:
type: "string"
format: "date"
description: "My date"
example: "2012-10-11"
但示例被插件忽略:在我生成的代码中,我有:
@ApiModelProperty(example = "Thu Oct 11 02:00:00 CEST 2012", required = true, value = "My date")
我想要一个像我的 yaml 文件中那样的示例。采用 YYYY-MM-DD 格式。
我在用着:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-spring-webmvc</artifactId>
<version>3.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.10.2</version>
</dependency>
对我来说,可以帮助输入我需要的格式的“字符串”。
start_at:
type: string
format: 'yyyy-mm-dd'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)