Skip to content

Commit 7bb6944

Browse files
ShikiSuenMasterain98qhy040404
authored
Update advices regarding Schema conformation. (#64)
* Update advices regarding Schema conformation. * Update docs * Update docs * Update docs * Update docs * Update UIAF docs --------- Co-authored-by: Masterain <[email protected]> Co-authored-by: qhy040404 <[email protected]>
1 parent 0abce11 commit 7bb6944

File tree

9 files changed

+68
-10
lines changed

9 files changed

+68
-10
lines changed

docs/.vuepress/navbar/en.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export const enNavbar = navbar([
2828
link: "https://github.com/Kamisato-Ayaka-233/mihoyo-api-collect",
2929
icon: "repo",
3030
},
31+
{
32+
text: "UIGF Schema Verify Tool",
33+
link: "https://schema.uigf.org/",
34+
icon: "tool"
35+
}
3136
],
3237
},
3338
]);

docs/.vuepress/navbar/zh.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export const zhNavbar = navbar([
2828
link: "/zh/mihoyo-api-collection-project.html",
2929
icon: "api",
3030
},
31+
{
32+
text: "UIGF 格式校验工具",
33+
link: "https://schema.uigf.org/",
34+
icon: "tool"
35+
}
3136
],
3237
},
3338
]);

docs/en/standards/srgf.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ Including only importing feature reduces the interchangeability of user data, an
4949

5050
## Json Schema
5151

52+
::: warning Mind the Field Types
53+
Devs are strongly urged to respect the data types of each property in the schema. Using incorrect types could result in errors when parsing JSON files by other tools developed in strong typing programming languages, leading to data transfer failures.
54+
55+
To avoid such issues, we recommend designing dedicated structs for the SRGF format or utilizing methods like `JsonNumberHandling.WriteAsString`. Additionally, it is advisable to design relevant unit tests to ensure consistency between imports and exports.
56+
57+
We also provide the [SRGF Json Schema Verify Tool](https://schema.uigf.org/?schema=srgf) to help you to verify validation of Json files.
58+
:::
59+
5260
```json
5361
{
5462
"$schema": "http://json-schema.org/draft-04/schema#",
@@ -122,7 +130,7 @@ Including only importing feature reduces the interchangeability of user data, an
122130
},
123131
"time": {
124132
"type": "string",
125-
"description": "Time of item achieved"
133+
"description": "Time when the item was obtained. This MUST BE THE String typed value captured intact from the gacha record webpage WITHOUT ANY CONVERTION TO ANY DATE TYPES. Any conversion of such can cause potential timezone mistakes if the device time zone differs from the server time zone, unless special treatments are applied by individual app devs."
126134
},
127135
"name": {
128136
"type": "string",

docs/en/standards/uiaf.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ All time in this standard are based on `UTC+8` time zone
3838

3939
## Json Schema
4040

41+
::: warning Mind the Field Types
42+
Devs are strongly urged to respect the data types of each property in the schema. Using incorrect types could result in errors when parsing JSON files by other tools developed in strong typing programming languages, leading to data transfer failures.
43+
44+
To avoid such issues, we recommend designing dedicated structs for the UIAF format or utilizing methods like `JsonNumberHandling.WriteAsString`. Additionally, it is advisable to design relevant unit tests to ensure consistency between imports and exports.
45+
46+
We also provide the [UIAF Json Schema Verify Tool](https://schema.uigf.org/?schema=uiaf) to help you to verify validation of Json files.
47+
:::
48+
4149
```json
4250
{
4351
"$schema": "http://json-schema.org/draft-04/schema#",

docs/en/standards/uigf-legacy-v2.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Item's in-game ID, refer to [UIGF API](../API.md) to get this data
140140
},
141141
"time": {
142142
"type": "string",
143-
"title": "Time of item achieved"
143+
"title": "Time when the item was obtained. "
144144
},
145145
"name": {
146146
"type": "string",

docs/en/standards/uigf.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,19 @@ Please remember to add corresponding uigf_gacha_type field when applying UIGF fo
8181

8282
### `item_id`
8383

84-
Item's in-game ID, refer to [UIGF API](../API.md) to get this data
84+
Item's in-game ID, refer to [UIGF API](../API.md) to get this data.
8585

8686
## Json Schema
8787

88-
> UIGF-Org provides [Json Schema](/schema/uigf.json) for validation
88+
> UIGF-Org provides the following JSON Schema for the validation of the data structure.
89+
90+
::: warning Mind the Field Types
91+
Devs are strongly urged to respect the data types of each property in the schema. Using incorrect types could result in errors when parsing JSON files by other tools developed in strong typing programming languages, leading to data transfer failures.
92+
93+
To avoid such issues, we recommend designing dedicated structs for the UIGF format or utilizing methods like `JsonNumberHandling.WriteAsString`. Additionally, it is advisable to design relevant unit tests to ensure consistency between imports and exports.
94+
95+
We also provide the [UIGF Json Schema Verify Tool](https://schema.uigf.org/?schema=uigf) to help you to verify validation of Json files.
96+
:::
8997

9098
```json
9199
{
@@ -156,7 +164,7 @@ Item's in-game ID, refer to [UIGF API](../API.md) to get this data
156164
},
157165
"time": {
158166
"type": "string",
159-
"title": "Time when the item was obtained"
167+
"title": "Time when the item was obtained. This MUST BE THE String typed value captured intact from the gacha record webpage WITHOUT ANY CONVERTION TO ANY DATE TYPES. Any conversion of such can cause potential timezone mistakes if the device time zone differs from the server time zone, unless special treatments are applied by individual app devs."
160168
},
161169
"name": {
162170
"type": "string",

docs/zh/standards/srgf.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ head:
4848

4949
## Json Schema
5050

51+
::: warning 注意字段类型
52+
请各位开发者务必尊重 Schema 内定义的字段类型。使用错误的类型可能会导致其它由强类型编程语言制成的工具在解析 Json 文件时产生错误,进而导致数据转移失败。
53+
54+
为了避免这类问题,我们建议您针对 SRGF 格式设计专用的 struct,或善用 `JsonNumberHandling.WriteAsString` 等方法。同时,设计相关的单元测试以确保导入导出的一致性。
55+
56+
我们也提供 [SRGF 格式校验工具](https://schema.uigf.org/?schema=srgf)来帮助你校验 Json 文件。
57+
:::
58+
5159
```json
5260
{
5361
"$schema": "http://json-schema.org/draft-04/schema#",
@@ -121,7 +129,7 @@ head:
121129
},
122130
"time": {
123131
"type": "string",
124-
"description": "获取物品的时间"
132+
"description": "获取物品的时间,应为「抽卡记录网页上显示的原始时间字符串」而非任何转换过的值。如果设备时区与服务器时区不一致,任意类型转换将会导致时区转换出现误差(除非应用进行了特殊处理)。"
125133
},
126134
"name": {
127135
"type": "string",

docs/zh/standards/uiaf.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ head:
3838

3939
## Json Schema
4040

41+
::: warning 注意字段类型
42+
请各位开发者务必尊重 Schema 内定义的字段类型。使用错误的类型可能会导致其它由强类型编程语言制成的工具在解析 Json 文件时产生错误,进而导致数据转移失败。
43+
44+
为了避免这类问题,我们建议您针对 UIAF 格式设计专用的 struct,或善用 `JsonNumberHandling.WriteAsString` 等方法。同时,设计相关的单元测试以确保导入导出的一致性。
45+
46+
我们也提供 [UIAF 格式校验工具](https://schema.uigf.org/?schema=uiaf)来帮助你校验 Json 文件。
47+
:::
48+
4149
```json
4250
{
4351
"$schema": "http://json-schema.org/draft-04/schema#",

docs/zh/standards/uigf.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ App 不应假定 `region_time_zone` 的值为上表中给出的值,应具有
6363

6464
由于存在会共享保底与概率的卡池,所以需要一个额外的字段来界定
6565
我们在 `UIGF` 的所有格式中注入了 `uigf_gacha_type` 字段
66-
在导出到 `UIGF` 格式时需要注意添加对应的 `uigf_gacha_type` 字段
66+
在导出到 `UIGF` 格式时需要注意添加对应的 `uigf_gacha_type` 字段
6767

6868
#### 映射关系
6969

@@ -77,11 +77,19 @@ App 不应假定 `region_time_zone` 的值为上表中给出的值,应具有
7777

7878
### `item_id`
7979

80-
物品游戏内ID,你可以通过 [UIGF API](../api.md) 获取这一数据
80+
物品游戏内ID,你可以通过 [UIGF API](../api.md) 获取这一数据
8181

8282
## Json Schema
8383

84-
> UIGF-Org 提供[Json Schema](/schema/uigf.json) 用于验证
84+
> UIGF-Org 提供下述 Json Schema 以用于验证资料结构的正确性。
85+
86+
::: warning 注意字段类型
87+
请各位开发者务必尊重 Schema 内定义的字段类型。使用错误的类型可能会导致其它由强类型编程语言制成的工具在解析 Json 文件时产生错误,进而导致数据转移失败。
88+
89+
为了避免这类问题,我们建议您针对 UIGF 格式设计专用的 struct,或善用 `JsonNumberHandling.WriteAsString` 等方法。同时,设计相关的单元测试以确保导入导出的一致性。
90+
91+
我们也提供 [UIGF 格式校验工具](https://schema.uigf.org/?schema=uigf)来帮助你校验 Json 文件。
92+
:::
8593

8694
```json
8795
{
@@ -152,7 +160,7 @@ App 不应假定 `region_time_zone` 的值为上表中给出的值,应具有
152160
},
153161
"time": {
154162
"type": "string",
155-
"title": "获取物品的时间"
163+
"description": "获取物品的时间,应为「抽卡记录网页上显示的原始时间字符串」而非任何转换过的值。如果设备时区与服务器时区不一致,任意类型转换将会导致时区转换出现误差(除非应用进行了特殊处理)。"
156164
},
157165
"name": {
158166
"type": "string",

0 commit comments

Comments
 (0)