@0disoft/universal-config-engine-validator-ajv 0.6.0 → 1.0.0-rc.2

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.
Files changed (2) hide show
  1. package/README.md +52 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @0disoft/universal-config-engine-validator-ajv
2
+
3
+ Ajv JSON Schema validation adapter for Universal Config Engine. Validation runs on
4
+ the normalized config object after source resolution and coercion.
5
+
6
+ ## Install
7
+
8
+ ```sh
9
+ npm install @0disoft/universal-config-engine-core \
10
+ @0disoft/universal-config-engine-validator-ajv ajv
11
+ ```
12
+
13
+ Node.js `>=24`, ESM, and Ajv `^8.20.0` are required.
14
+
15
+ ## Use
16
+
17
+ ```js
18
+ import { runValidators } from "@0disoft/universal-config-engine-core";
19
+ import { createAjvValidator } from "@0disoft/universal-config-engine-validator-ajv";
20
+
21
+ const validator = createAjvValidator({
22
+ id: "service-schema",
23
+ schema: {
24
+ type: "object",
25
+ required: ["service"],
26
+ properties: {
27
+ service: {
28
+ type: "object",
29
+ required: ["port"],
30
+ properties: { port: { type: "integer", minimum: 1 } }
31
+ }
32
+ }
33
+ }
34
+ });
35
+
36
+ const validation = await runValidators({
37
+ config: { service: { port: 8080 } },
38
+ provenance: [],
39
+ validators: [validator]
40
+ });
41
+
42
+ console.log(validation.ok);
43
+ ```
44
+
45
+ Ajv instance paths are normalized into Universal Config Engine paths. Numeric-looking
46
+ object keys remain strings unless traversal proves that the parent is an array.
47
+
48
+ See the [validator adapter contract](https://github.com/0disoft/universal-config-engine/blob/main/docs/adapters/README.md).
49
+
50
+ ## License
51
+
52
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0disoft/universal-config-engine-validator-ajv",
3
- "version": "0.6.0",
3
+ "version": "1.0.0-rc.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "@0disoft/universal-config-engine-core": "0.6.0"
40
+ "@0disoft/universal-config-engine-core": "1.0.0-rc.2"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "ajv": "^8.20.0"