Files
brapi-java/docs/problem_fix/03-fix-doing/01-get-attributes.md

1.8 KiB
Raw Blame History

GET /attributes

来源BrAPI v2.1 校验报告03-fix.md

概要

状态 warning
方法 GET
URL /brapi/v2/attributes
完整 URL http://localhost:8081/brapi/v2/attributes
路径模板 GET /attributes
模块 Germplasm Attributes
响应时间 8885 ms

校验详情

GET /attributes
Germplasm Attributes
8885 ms
schema mismatch
schema mismatch
Json matches schema: schemas/v2.1/metadata.json (schema mismatch) — Schema: schemas/v2.1/metadata.json
Server response is not valid JSON.
Json matches schema: schemas/v2.1/GermplasmAttributes/getAttributesResponse.json (schema mismatch) — Schema: schemas/v2.1/GermplasmAttributes/getAttributesResponse.json
Server response is not valid JSON.

修复说明

  • 根因:种子数据在 additional_info.value 中以 Java 序列化形式存储 Boolean.TRUEGermplasmAttributeService.convertFromEntity()ObservationVariableService.convertFromBaseEntity()UpdateUtility.convertFromEntity() 调用 entity.getAdditionalInfoMap() 映射 additionalInfo,原先直接返回反序列化后的 BooleanJackson 输出 JSON boolean与 BrAPI schemaadditionalInfo 值须为 string不符校验器报 schema mismatch / not valid JSON。
  • 修复:在 BrAPIPrimaryEntity.getAdditionalInfoMap() 中对每个值使用 String.valueOf(),使 dummyData 等字段以 "true" 字符串返回(与 #2 attributevalues、#8 crossingprojects 等共用修复)。
  • 验证GET /brapi/v2/attributes 返回 20024 条记录中 2 条含 dummyDataattribute1、attribute2均为 JSON 字符串 "dummyData":"true",无 boolean 类型;嵌套 method/scale/trait 序列化正常。

状态:已完成