Skip to content

Commit

Permalink
🐛 fix: 修正 schema 类型
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Apr 9, 2021
1 parent bb70bf4 commit f688dcd
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/journey-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"build": "yarn schema && father-build && yarn webpack",
"webpack": "webpack",
"schema": "typescript-json-schema src/types/yml.ts YMLJourneyMap -o ./schema/journey-map.schema.json --id=journey-map-schema --required --ignoreErrors",
"schema": "typescript-json-schema src/types/yml.ts YMLJourneyMapRawData -o ./schema/journey-map.schema.json --id=journey-map-schema --required --ignoreErrors",
"test": "jest",
"test:update": "jest -u",
"prepublishOnly": "yarn build",
Expand Down
52 changes: 49 additions & 3 deletions packages/journey-map/schema/journey-map.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,29 @@
"Config": {
"description": "图表配置",
"properties": {
"arrange": {
"description": "section 的排序",
"items": {
"enum": [
"action",
"chance",
"emotion",
"painSpot",
"stage",
"thought"
],
"type": "string"
},
"type": "array"
},
"color": {
"description": "主色",
"type": "string"
},
"height": {
"$ref": "journey-map-schema#/definitions/Partial<Record<SectionType,number>>",
"description": "每个部分的高度"
},
"section": {
"description": "显示左侧区域",
"type": "boolean"
Expand All @@ -20,9 +39,36 @@
},
"type": "object"
},
"Partial<Record<SectionType,number>>": {
"properties": {
"action": {
"type": "number"
},
"chance": {
"type": "number"
},
"emotion": {
"type": "number"
},
"painSpot": {
"type": "number"
},
"stage": {
"type": "number"
},
"thought": {
"type": "number"
}
},
"type": "object"
},
"UserAction": {
"description": "用户行为",
"description": "用户行为类型",
"properties": {
"color": {
"description": "action 的颜色",
"type": "string"
},
"description": {
"description": "说明",
"type": "string"
Expand Down Expand Up @@ -82,7 +128,7 @@
"properties": {
"config": {
"$ref": "journey-map-schema#/definitions/Config",
"description": "配置项"
"description": "配置参数"
},
"stages": {
"description": "步骤",
Expand All @@ -92,7 +138,7 @@
"type": "array"
},
"title": {
"description": "旅程图名称",
"description": "标题名",
"type": "string"
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/journey-map/src/types/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export interface Config {
/**
* 每个部分的高度
*/
height?: Record<Partial<SectionType>, number>;
height?: Partial<Record<SectionType, number>>;
/**
* section 的排序
*/
Expand Down

1 comment on commit f688dcd

@vercel
Copy link

@vercel vercel bot commented on f688dcd Apr 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.