我的问题有点复杂,我会尽量解释清楚。为此,我做了一个简单的项目。
我正在使用Swagger 代码生成器从 swagger 文件生成 Java 类。在 swagger 文件中,定义使用了 additionalnalProperties。
MyRequestBody:
type: object
properties:
property1:
type: string
property2:
type: string
additionalProperties:
type: object
Run Code Online (Sandbox Code Playgroud)
生成的java类:
/*
* Chatbot api
* Api for chatbot interface.
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package lu.post.models.api.test;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap; …Run Code Online (Sandbox Code Playgroud)