我正在使用swagger代码生成器为客户端生成代码。
这是我所做的:
1.Genrate Swagger Json:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${mavenSurefire.version}</version>
<configuration>
<argLine>--illegal-access=permit ${argLine}</argLine>
<systemPropertyVariables>
<io.springfox.staticdocs.outputDir>${swagger.output.dir}</io.springfox.staticdocs.outputDir>
<io.springfox.staticdocs.snippetsOutputDir>${swagger.snippetOutput.dir}</io.springfox.staticdocs.snippetsOutputDir>
</systemPropertyVariables>
</configuration>
</plugin>
2。使用swagger-codegen-maven-plugin生成客户端代码:
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swaggerCodegen.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${swagger.input}</inputSpec>
<language>java</language>
<modelPackage>com.client.model.products</modelPackage>
<apiPackage>com.client.api.products</apiPackage>
<output>${project.basedir}/../rest-client</output>
<configOptions>
<sourceFolder>src/gen/java</sourceFolder>
</configOptions>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>
</configuration>
<phase>package</phase>
</execution>
</executions>
</plugin>
在我要生成的Product对象中,有一个类型为Map<String, Object>
的属性。生成后,将其更改为对象。我想保持其类型为Map吗?谁能帮我得到它吗?