在swagger UI中无法显示正确的示例

时间:2019-01-04 23:02:46

标签: java swagger

我用粗体定义了示例,但是一个地方没有按我的预期显示,我想显示“ 14 Cycle way”之类的地址,但是用粗体,它只以json格式显示“ 14”。

我尝试其他示例,除“数字+字符”外,所有作品,例如“ 14循环方式”。我想知道swagger是否在幕后做些什么,但是我不知道如何通过设置一些端点进行调试,因为我不知道swagger的工作在哪里。

这是我的代码

@Schema(description = "Address details in V2 schema")
public interface Address extends ModelObject {

  @Schema(description = "The given address line 1", example = "14 Cycle way")
  String getAddressLine1();

  Address setAddressLine1(String addressLine1);

  @Schema(description = "The given address line 2", example = "Apartment 12")
  String getAddressLine2();

  Address setAddressLine2(String addressLine2);

  @Schema(description = "The given city", example = "Fremount")
  String getCity();

  Address setCity(String city);

  @Schema(description = "The given district/state", example = "CA")
  String getDistrict();

  Address setDistrict(String district);

  @Schema(description = "The given postal code", example = "97658")
  String getPostalCode();

  Address setPostalCode(String postalCode);

}

这是挥霍的示例值

"address": {
    "district": "CA",
    "postalCode": "97658",
    "addressLine1": "14", // it only show 14 there
    "city": "Fremount",
    "addressLine2": "Apartment 12"
  },

0 个答案:

没有答案