codify-schemas 1.0.9 → 1.0.11
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config-file-schema.json +2 -2
- package/src/config-file-schema.test.ts +2 -2
- package/src/index.ts +1 -2
- package/src/ipc-message-schema.json +1 -1
- package/src/ipc-message-schema.test.ts +2 -2
- package/src/messages/apply-request-data-schema.json +1 -1
- package/src/messages/apply-response-data-schema.json +1 -1
- package/src/messages/error-response-data-schema.json +2 -2
- package/src/messages/get-resources-response-data-schema.json +1 -1
- package/src/messages/get-resources-response-data-schema.test.ts +2 -2
- package/src/messages/plan-request-data-schema.json +1 -1
- package/src/messages/plan-request-data-schema.test.ts +2 -2
- package/src/messages/plan-response-data-schema.json +1 -1
- package/src/messages/validate-request-data-schema.json +1 -1
- package/src/messages/validate-response-data-schema.json +1 -1
- package/src/project-schema.json +2 -2
- package/src/project-schema.test.ts +2 -5
- package/src/resource-schema.json +2 -2
- package/src/resource-schema.test.ts +2 -2
- package/tsconfig.json +2 -2
- package/src/resource-meta-schema.json +0 -32
- package/src/resource-meta-schema.test.ts +0 -120
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export { default as PlanRequestDataSchema } from './messages/plan-request-data-s
|
|
|
10
10
|
export { default as PlanResponseDataSchema } from './messages/plan-response-data-schema.json';
|
|
11
11
|
export { default as ValidateRequestDataSchema } from './messages/validate-request-data-schema.json';
|
|
12
12
|
export { default as ValidateResponseDataSchema } from './messages/validate-response-data-schema.json';
|
|
13
|
-
export * from './types';
|
|
13
|
+
export * from './types/index.js';
|
package/dist/index.js
CHANGED
|
@@ -10,5 +10,5 @@ export { default as PlanRequestDataSchema } from './messages/plan-request-data-s
|
|
|
10
10
|
export { default as PlanResponseDataSchema } from './messages/plan-response-data-schema.json';
|
|
11
11
|
export { default as ValidateRequestDataSchema } from './messages/validate-request-data-schema.json';
|
|
12
12
|
export { default as ValidateResponseDataSchema } from './messages/validate-response-data-schema.json';
|
|
13
|
-
export * from './types';
|
|
13
|
+
export * from './types/index.js';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AAC/F,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACpG,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AACtG,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,4CAA4C,CAAA;AAC/F,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACpG,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AACtG,cAAc,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codify.com/config-file-schema.json",
|
|
4
4
|
"title": "Config file Schema",
|
|
5
5
|
"type": "array",
|
|
6
6
|
"items": {
|
|
7
7
|
"$ref": "resource-schema.json"
|
|
8
8
|
}
|
|
9
|
-
}
|
|
9
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Ajv2020 from "ajv/dist/2020";
|
|
2
1
|
import configSchema from './config-file-schema.json';
|
|
3
2
|
import resourceSchema from './resource-schema.json';
|
|
4
3
|
import { describe, it, expect } from 'vitest'
|
|
4
|
+
import Ajv from "ajv";
|
|
5
5
|
|
|
6
|
-
const ajv = new
|
|
6
|
+
const ajv = new Ajv({
|
|
7
7
|
strict: true,
|
|
8
8
|
})
|
|
9
9
|
ajv.addSchema(resourceSchema);
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as ConfigFileSchema } from './config-file-schema.json';
|
|
2
2
|
export { default as ProjectSchema } from './project-schema.json';
|
|
3
|
-
export { default as ResourceMetaSchema } from './resource-meta-schema.json';
|
|
4
3
|
export { default as ResourceSchema } from './resource-schema.json';
|
|
5
4
|
export { default as IpcMessageSchema } from './ipc-message-schema.json';
|
|
6
5
|
export { default as ApplyRequestDataSchema } from './messages/apply-request-data-schema.json';
|
|
@@ -10,4 +9,4 @@ export { default as PlanRequestDataSchema } from './messages/plan-request-data-s
|
|
|
10
9
|
export { default as PlanResponseDataSchema } from './messages/plan-response-data-schema.json';
|
|
11
10
|
export { default as ValidateRequestDataSchema } from './messages/validate-request-data-schema.json';
|
|
12
11
|
export { default as ValidateResponseDataSchema } from './messages/validate-response-data-schema.json';
|
|
13
|
-
export * from './types';
|
|
12
|
+
export type * from './types/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codify.com/apply-request-data-schema.json",
|
|
4
4
|
"title": "Apply Request Schema Data",
|
|
5
5
|
"description": "Apply the previously generated plan. The plan must already be generated in order for apply to work.",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codify.com/error-response-data-schema.json",
|
|
4
4
|
"title": "Error Response Schema Data",
|
|
5
5
|
"type": "object",
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
},
|
|
12
12
|
"required": ["reason"],
|
|
13
13
|
"additionalProperties": false
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Ajv2020 from "ajv/dist/2020";
|
|
2
1
|
import schema from './get-resources-response-data-schema.json';
|
|
3
2
|
import resourceSchema from '../resource-schema.json'
|
|
4
3
|
import { describe, it, expect } from 'vitest'
|
|
4
|
+
import Ajv from "ajv";
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
const ajv = new
|
|
7
|
+
const ajv = new Ajv({
|
|
8
8
|
strict: true,
|
|
9
9
|
})
|
|
10
10
|
ajv.addSchema(resourceSchema);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Ajv2020 from "ajv/dist/2020";
|
|
2
1
|
import schema from './plan-request-data-schema.json';
|
|
3
2
|
import resourceSchema from '../resource-schema.json'
|
|
4
3
|
import { describe, it, expect } from 'vitest'
|
|
4
|
+
import Ajv from "ajv";
|
|
5
5
|
|
|
6
|
-
const ajv = new
|
|
6
|
+
const ajv = new Ajv({
|
|
7
7
|
strict: true,
|
|
8
8
|
})
|
|
9
9
|
ajv.addSchema(resourceSchema);
|
package/src/project-schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codify.com/resource-schema.json",
|
|
4
4
|
"title": "Resource Schema",
|
|
5
5
|
"type": "object",
|
|
@@ -29,4 +29,4 @@
|
|
|
29
29
|
},
|
|
30
30
|
"additionalProperties": false,
|
|
31
31
|
"required": ["type"]
|
|
32
|
-
}
|
|
32
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Ajv2020 from "ajv/dist/2020";
|
|
2
1
|
import schema from './project-schema.json';
|
|
3
2
|
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import Ajv from "ajv";
|
|
4
4
|
|
|
5
|
-
const ajv = new
|
|
5
|
+
const ajv = new Ajv({
|
|
6
6
|
strict: true,
|
|
7
7
|
})
|
|
8
8
|
|
|
@@ -41,7 +41,4 @@ describe("project file schema tests", () => {
|
|
|
41
41
|
}
|
|
42
42
|
})).to.be.true;
|
|
43
43
|
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
44
|
})
|
package/src/resource-schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://www.codify.com/resource-schema.json",
|
|
4
4
|
"title": "Resource Schema",
|
|
5
5
|
"type": "object",
|
|
@@ -23,4 +23,4 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"required": ["type"]
|
|
26
|
-
}
|
|
26
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "Config file Schema",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"properties": {
|
|
6
|
-
"$id": {
|
|
7
|
-
"type": "string",
|
|
8
|
-
"pattern": "^https://www.codify.com/"
|
|
9
|
-
},
|
|
10
|
-
"type": {
|
|
11
|
-
"const": "object"
|
|
12
|
-
},
|
|
13
|
-
"properties": {
|
|
14
|
-
"type": "object",
|
|
15
|
-
"properties": {
|
|
16
|
-
"type": false,
|
|
17
|
-
"name": false,
|
|
18
|
-
"dependsOn": false,
|
|
19
|
-
"$ref": {
|
|
20
|
-
"const": "https://www.codify.com/resource-schema.json#properties"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"$ref": {
|
|
25
|
-
"const": "https://www.codify.com/resource-schema.json"
|
|
26
|
-
},
|
|
27
|
-
"unevaluatedProperties": {
|
|
28
|
-
"const": false
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"required": ["unevaluatedProperties", "$ref"]
|
|
32
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import Ajv2020 from "ajv/dist/2020";
|
|
2
|
-
import schema from './resource-meta-schema.json';
|
|
3
|
-
import resourceSchema from './resource-schema.json';
|
|
4
|
-
import { describe, it, expect } from 'vitest'
|
|
5
|
-
|
|
6
|
-
const ajv = new Ajv2020({
|
|
7
|
-
strict: true,
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
describe("Resource meta schema tests", () => {
|
|
11
|
-
it("compiles", () => {
|
|
12
|
-
ajv.compile(schema);
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it("must have additional properties and $ref to resource-schema specified", () => {
|
|
16
|
-
const validate = ajv.compile(schema);
|
|
17
|
-
|
|
18
|
-
expect(validate({
|
|
19
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
20
|
-
"type": "object",
|
|
21
|
-
"properties": {
|
|
22
|
-
"prop1": {
|
|
23
|
-
"type": "string"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
})).to.be.false;
|
|
27
|
-
|
|
28
|
-
expect(validate({
|
|
29
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
30
|
-
"type": "object",
|
|
31
|
-
"properties": {
|
|
32
|
-
"prop1": {
|
|
33
|
-
"type": "string"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"unevaluatedProperties": false,
|
|
37
|
-
"$ref": "https://www.codify.com/resource-schema.json"
|
|
38
|
-
})).to.be.true;
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it("does not allow resource keywords to be specified", () => {
|
|
42
|
-
const validate = ajv.compile(schema);
|
|
43
|
-
|
|
44
|
-
expect(validate({
|
|
45
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
46
|
-
"type": "object",
|
|
47
|
-
"properties": {
|
|
48
|
-
"type": {
|
|
49
|
-
"type": "string"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"unevaluatedProperties": false,
|
|
53
|
-
"$ref": "https://www.codify.com/resource-schema.json"
|
|
54
|
-
})).to.be.false;
|
|
55
|
-
|
|
56
|
-
expect(validate({
|
|
57
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
58
|
-
"type": "object",
|
|
59
|
-
"properties": {
|
|
60
|
-
"name": {
|
|
61
|
-
"type": "string"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"unevaluatedProperties": false,
|
|
65
|
-
"$ref": "https://www.codify.com/resource-schema.json"
|
|
66
|
-
})).to.be.false;
|
|
67
|
-
|
|
68
|
-
expect(validate({
|
|
69
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
70
|
-
"type": "object",
|
|
71
|
-
"properties": {
|
|
72
|
-
"dependsOn": {
|
|
73
|
-
"type": "array"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"unevaluatedProperties": false,
|
|
77
|
-
"$ref": "https://www.codify.com/resource-schema.json"
|
|
78
|
-
})).to.be.false;
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
it("allows for schema composition with base resource schema", () => {
|
|
82
|
-
const resourceMetaSchema = schema;
|
|
83
|
-
const propertySchema = {
|
|
84
|
-
$id: "https://www.codify.com/property-schema.json",
|
|
85
|
-
type: "object",
|
|
86
|
-
properties: {
|
|
87
|
-
prop1: {
|
|
88
|
-
type: "string"
|
|
89
|
-
},
|
|
90
|
-
prop2: {
|
|
91
|
-
type: "string"
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
$ref: "https://www.codify.com/resource-schema.json",
|
|
95
|
-
unevaluatedProperties: false,
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const resourceConfigInvalid = {
|
|
99
|
-
prop1: "a",
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const resourceConfigValid = {
|
|
103
|
-
type: "resource-config",
|
|
104
|
-
prop1: "a",
|
|
105
|
-
dependsOn: ["resource-config-2"]
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const ajv = new Ajv2020({
|
|
109
|
-
strict: true,
|
|
110
|
-
schemas: [resourceSchema]
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const metaSchemaValidator = ajv.compile(resourceMetaSchema);
|
|
114
|
-
expect(metaSchemaValidator(propertySchema)).to.be.true;
|
|
115
|
-
|
|
116
|
-
const resourceValidator = ajv.compile(propertySchema);
|
|
117
|
-
expect(resourceValidator(resourceConfigValid)).to.be.true;
|
|
118
|
-
expect(resourceValidator(resourceConfigInvalid)).to.be.false;
|
|
119
|
-
})
|
|
120
|
-
});
|