42 lines
1.8 KiB
Markdown
42 lines
1.8 KiB
Markdown
# 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.TRUE`;`GermplasmAttributeService.convertFromEntity()` 经 `ObservationVariableService.convertFromBaseEntity()` → `UpdateUtility.convertFromEntity()` 调用 `entity.getAdditionalInfoMap()` 映射 `additionalInfo`,原先直接返回反序列化后的 `Boolean`,Jackson 输出 JSON boolean,与 BrAPI schema(`additionalInfo` 值须为 string)不符,校验器报 schema mismatch / not valid JSON。
|
||
- **修复**:在 `BrAPIPrimaryEntity.getAdditionalInfoMap()` 中对每个值使用 `String.valueOf()`,使 `dummyData` 等字段以 `"true"` 字符串返回(与 #2 attributevalues、#8 crossingprojects 等共用修复)。
|
||
- **验证**:`GET /brapi/v2/attributes` 返回 200;24 条记录中 2 条含 `dummyData`(attribute1、attribute2),均为 JSON 字符串 `"dummyData":"true"`,无 boolean 类型;嵌套 method/scale/trait 序列化正常。
|
||
|
||
---
|
||
|
||
**状态:已完成**
|