@done-coding/schema-api 0.0.1-alpha.1 → 0.0.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,9 @@
4
4
  跨前后端通用接口结构的类型、常量与定义文件
5
5
  ```
6
6
 
7
- 成功外壳、错误体、三种列表(一次性 / 页码式 / 游标式)、列表请求参数与业务码的 TypeScript 类型、字段路径常量与 JSON Schema 定义文件,由同一份定义生成;同版本的 Python 包为 PyPI 上的 `done-coding-schema-api`。
7
+ 成功外壳、错误体、三种列表(一次性 / 页码式 / 游标式)、列表请求参数与业务码的 TypeScript 类型与 JSON Schema 定义文件,由同一份定义生成;同版本的 Python 包为 PyPI 上的 `done-coding-schema-api`。
8
+
9
+ 两个出口:主入口 `@done-coding/schema-api` 只有结构(类型、成功码、结构定义文件);通用失败码与码表、字段路径与参数名、参考数值在 `@done-coding/schema-api/reference`,只是参考,不随结构生效,要用须显式引入。
8
10
 
9
11
  ## 使用
10
12
 
@@ -13,11 +15,8 @@ npm install @done-coding/schema-api
13
15
  ```
14
16
 
15
17
  ```ts
16
- import {
17
- PAGED_LIST_REQUEST_PARAMS,
18
- type PagedList,
19
- type SuccessEnvelope,
20
- } from "@done-coding/schema-api";
18
+ import type { PagedList, SuccessEnvelope } from "@done-coding/schema-api";
19
+ import { PAGED_LIST_REQUEST_PARAMS } from "@done-coding/schema-api/reference";
21
20
 
22
21
  interface User {
23
22
  id: string;
@@ -29,6 +28,6 @@ response.data.page.totalRecord; // number
29
28
  PAGED_LIST_REQUEST_PARAMS.pageSize; // "page.pageSize"
30
29
  ```
31
30
 
32
- 定义文件以 `schemas` 导出,也可按路径取:`@done-coding/schema-api/schemas/<结构名>.schema.json`。
31
+ 结构定义文件以 `schemas` 导出,参考资源定义文件以 `referenceSchemas` 从 `./reference` 导出,也可按路径取:`@done-coding/schema-api/schemas/<结构名>.schema.json`。
33
32
 
34
33
  各结构的说明、怎么选列表、业务码与版本规则见仓库 README:<https://github.com/done-coding/done-coding-schema#readme>