swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Default Value not getting assigned to the variable in generated typescript

Open gpadbidri opened this issue 1 year ago • 0 comments

I am using io.swagger.v3.oas.annotations namespace in my Soring Boot application to generate Swagger documentation.

This is my POJO : @Data @AllArgsConstructor @Schema(name="CustomPojoDTO") public class CustomPojo {

@Schema(description = "Type representing the node", defaultValue = "ADD_TO_LIST", type = "string", example="ADD_TO_LIST")
@Parameter(schema = @Schema(type = "string", defaultValue = "ADD_TO_LIST"))
@JsonProperty("type") // Map the JSON property to Java property
private String type = "ADD_TO_LIST"; // Default value ADD_TO_LIST

}

Genreated ts contains :

/**

  • Action Type representing the node
  • @default "LIST_NODE"
  • @example "LIST_NODE" */ type ?: string;

However I want to assign the value LIST_NODE as the default value. It fails. What can be done to achieve this ? Please let me know. Thanks !

Swagger displays it this way :

image

gpadbidri avatar Apr 26 '24 12:04 gpadbidri