@percy/config 1.7.2 → 1.9.0

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/dist/validate.js +13 -9
  2. package/package.json +3 -3
package/dist/validate.js CHANGED
@@ -131,14 +131,18 @@ export function addSchema(schemas) {
131
131
  ajv.removeSchema('/config');
132
132
 
133
133
  for (let [key, schema] of entries(schemas)) {
134
- let $id = `/config/${key}`;
135
- if (ajv.getSchema($id)) ajv.removeSchema($id);
136
- assign(config.properties, {
137
- [key]: {
138
- $ref: $id
139
- }
140
- });
141
- ajv.addSchema(schema, $id);
134
+ if (key === '$config') {
135
+ assign(config, typeof schema === 'function' ? schema(config) : schema);
136
+ } else {
137
+ let $id = `/config/${key}`;
138
+ if (ajv.getSchema($id)) ajv.removeSchema($id);
139
+ assign(config.properties, {
140
+ [key]: {
141
+ $ref: $id
142
+ }
143
+ });
144
+ ajv.addSchema(schema, $id);
145
+ }
142
146
  }
143
147
 
144
148
  return ajv.addSchema(config, '/config');
@@ -155,7 +159,7 @@ function a(word) {
155
159
  } // Default errors anywhere within these keywords can be confusing
156
160
 
157
161
 
158
- const HIDE_NESTED_KEYWORDS = ['oneOf', 'anyOf', 'allOf', 'not'];
162
+ const HIDE_NESTED_KEYWORDS = ['oneOf', 'anyOf', 'allOf', 'if', 'then', 'else', 'not'];
159
163
 
160
164
  function shouldHideError(key, path, error) {
161
165
  var _parentSchema$errors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/config",
3
- "version": "1.7.2",
3
+ "version": "1.9.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "test:types": "tsd"
35
35
  },
36
36
  "dependencies": {
37
- "@percy/logger": "1.7.2",
37
+ "@percy/logger": "1.9.0",
38
38
  "ajv": "^8.6.2",
39
39
  "cosmiconfig": "^7.0.0",
40
40
  "yaml": "^2.0.0"
@@ -42,5 +42,5 @@
42
42
  "devDependencies": {
43
43
  "json-schema-typed": "^7.0.3"
44
44
  },
45
- "gitHead": "d9da4a4f9eafc3c3ac361a50f679f030172ad362"
45
+ "gitHead": "3332a2a63802c58848d0a5fbdd3c7aadc076212b"
46
46
  }