Skip to content

Commit 2962f25

Browse files
authored
Externalise json schemas (#66)
So we can reference them in generated output from Cucumber implementations, to help users understand and process the format.
1 parent 1d3b5cc commit 2962f25

21 files changed

+1532
-1306
lines changed

.mocharc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"loader": "ts-node/esm",
2+
"require": "ts-node/register",
33
"extension": ["ts"]
44
}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Changed
10+
- Remove dual CommonJS/ESM entry points in favour of single CommonJS entry point [#66](https://github.com/cucumber/cucumber-json-converter/pull/66)
11+
- Externalise JSON schemas [#66](https://github.com/cucumber/cucumber-json-converter/pull/66)
912

1013
## [0.0.3] - 2022-03-23
1114
### Fixed

package.cjs.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,14 @@
22
"name": "@cucumber/cucumber-json-converter",
33
"version": "0.0.3",
44
"description": "Validates and converts Cucumber JSON for different Cucumber implementations and versions",
5-
"type": "module",
6-
"main": "dist/cjs/src/index.js",
7-
"types": "dist/cjs/src/index.d.ts",
5+
"main": "dist/src/index.js",
6+
"types": "dist/src/index.d.ts",
87
"files": [
9-
"dist/cjs",
10-
"dist/esm"
8+
"dist"
119
],
12-
"module": "dist/esm/src/index.js",
13-
"jsnext:main": "dist/esm/src/index.js",
14-
"exports": {
15-
".": {
16-
"import": "./dist/esm/src/index.js",
17-
"require": "./dist/cjs/src/index.js"
18-
}
19-
},
2010
"scripts": {
21-
"build:cjs": "tsc --build tsconfig.build-cjs.json && cp package.cjs.json dist/cjs/package.json",
22-
"build:esm": "tsc --build tsconfig.build-esm.json",
23-
"build": "npm run build:cjs && npm run build:esm",
24-
"test": "mocha && npm run test:cjs",
25-
"test:cjs": "npm run build:cjs && mocha --no-config dist/cjs/test",
11+
"build": "tsc --build tsconfig.build.json",
12+
"test": "mocha",
2613
"prepublishOnly": "npm run build",
2714
"eslint-fix": "eslint --ext ts --max-warnings 0 --fix src test",
2815
"eslint": "eslint --ext ts --max-warnings 0 src test",

schemas/behave.json

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/BehaveJson",
4+
"definitions": {
5+
"BehaveJson": {
6+
"type": "array",
7+
"items": {
8+
"$ref": "#/definitions/Feature"
9+
}
10+
},
11+
"Feature": {
12+
"type": "object",
13+
"properties": {
14+
"status": {
15+
"$ref": "#/definitions/Status"
16+
},
17+
"location": {
18+
"type": "string"
19+
},
20+
"keyword": {
21+
"type": "string"
22+
},
23+
"name": {
24+
"type": "string"
25+
},
26+
"description": {
27+
"type": "array",
28+
"items": {
29+
"type": "string"
30+
}
31+
},
32+
"elements": {
33+
"type": "array",
34+
"items": {
35+
"$ref": "#/definitions/Element"
36+
}
37+
},
38+
"tags": {
39+
"type": "array",
40+
"items": {
41+
"type": "string"
42+
}
43+
}
44+
},
45+
"required": [
46+
"status",
47+
"location",
48+
"keyword",
49+
"name",
50+
"elements",
51+
"tags"
52+
],
53+
"additionalProperties": false
54+
},
55+
"Status": {
56+
"type": "string",
57+
"enum": [
58+
"passed",
59+
"failed",
60+
"skipped",
61+
"undefined"
62+
]
63+
},
64+
"Element": {
65+
"type": "object",
66+
"properties": {
67+
"steps": {
68+
"type": "array",
69+
"items": {
70+
"$ref": "#/definitions/Step"
71+
}
72+
},
73+
"type": {
74+
"type": "string",
75+
"enum": [
76+
"background",
77+
"scenario"
78+
]
79+
},
80+
"name": {
81+
"type": "string"
82+
},
83+
"description": {
84+
"type": "array",
85+
"items": {
86+
"type": "string"
87+
}
88+
},
89+
"keyword": {
90+
"type": "string"
91+
},
92+
"location": {
93+
"type": "string"
94+
},
95+
"tags": {
96+
"type": "array",
97+
"items": {
98+
"type": "string"
99+
}
100+
},
101+
"status": {
102+
"$ref": "#/definitions/Status"
103+
}
104+
},
105+
"required": [
106+
"steps",
107+
"type",
108+
"name",
109+
"keyword",
110+
"location"
111+
],
112+
"additionalProperties": false
113+
},
114+
"Step": {
115+
"type": "object",
116+
"properties": {
117+
"step_type": {
118+
"type": "string"
119+
},
120+
"name": {
121+
"type": "string"
122+
},
123+
"keyword": {
124+
"type": "string"
125+
},
126+
"location": {
127+
"type": "string"
128+
},
129+
"result": {
130+
"$ref": "#/definitions/Result"
131+
},
132+
"match": {
133+
"$ref": "#/definitions/Match"
134+
},
135+
"table": {
136+
"$ref": "#/definitions/Table"
137+
},
138+
"text": {
139+
"type": "string"
140+
}
141+
},
142+
"required": [
143+
"step_type",
144+
"name",
145+
"keyword",
146+
"location"
147+
],
148+
"additionalProperties": false
149+
},
150+
"Result": {
151+
"type": "object",
152+
"properties": {
153+
"status": {
154+
"$ref": "#/definitions/Status"
155+
},
156+
"duration": {
157+
"type": "number"
158+
},
159+
"error_message": {
160+
"type": "array",
161+
"items": {
162+
"type": "string"
163+
}
164+
}
165+
},
166+
"required": [
167+
"status",
168+
"duration"
169+
],
170+
"additionalProperties": false
171+
},
172+
"Match": {
173+
"type": "object",
174+
"properties": {
175+
"location": {
176+
"type": "string"
177+
},
178+
"arguments": {
179+
"type": "array",
180+
"items": {
181+
"$ref": "#/definitions/Argument"
182+
}
183+
}
184+
},
185+
"required": [
186+
"location",
187+
"arguments"
188+
],
189+
"additionalProperties": false
190+
},
191+
"Argument": {
192+
"type": "object",
193+
"properties": {
194+
"name": {
195+
"type": "string"
196+
},
197+
"value": {},
198+
"original": {
199+
"type": "string"
200+
}
201+
},
202+
"required": [
203+
"name",
204+
"value",
205+
"original"
206+
],
207+
"additionalProperties": false
208+
},
209+
"Table": {
210+
"type": "object",
211+
"properties": {
212+
"rows": {
213+
"type": "array",
214+
"items": {
215+
"$ref": "#/definitions/Row"
216+
}
217+
}
218+
},
219+
"required": [
220+
"rows"
221+
],
222+
"additionalProperties": false
223+
},
224+
"Row": {
225+
"type": "array",
226+
"items": {
227+
"type": "string"
228+
}
229+
}
230+
}
231+
}

0 commit comments

Comments
 (0)