@hyperjump/json-schema 1.17.4 → 1.17.5
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/README.md +2 -2
- package/bundle/index.js +4 -0
- package/formats/handlers/draft-04/hostname.js +2 -2
- package/lib/keywords/requireAllExcept.js +1 -1
- package/lib/pubsub.js +3 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,8 +144,8 @@ use `@hyperjump/json-schema/formats-lite` instead to leave out support for those
|
|
|
144
144
|
formats.
|
|
145
145
|
|
|
146
146
|
```javascript
|
|
147
|
-
import { registerSchema, validate } from "@hyperjump/json-schema/draft-2020-12";
|
|
148
|
-
import
|
|
147
|
+
import { registerSchema, setShouldValidateFormat, validate } from "@hyperjump/json-schema/draft-2020-12";
|
|
148
|
+
import "@hyperjump/json-schema/formats";
|
|
149
149
|
|
|
150
150
|
const schemaUri = "https://example.com/number";
|
|
151
151
|
registerSchema({
|
package/bundle/index.js
CHANGED
|
@@ -61,6 +61,10 @@ const doBundling = async (schemaUri, bundled, fullOptions, contextSchema, visite
|
|
|
61
61
|
bundled = await doBundling(uri, bundled, fullOptions, schema, visited);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
if (Object.keys(JsonPointer.get(fullOptions.bundlingLocation, bundled)).length === 0) {
|
|
65
|
+
JsonPointer.remove(fullOptions.bundlingLocation, bundled);
|
|
66
|
+
}
|
|
67
|
+
|
|
64
68
|
return bundled;
|
|
65
69
|
};
|
|
66
70
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isHostname } from "@hyperjump/json-schema-formats";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
id: "https://json-schema.org/format/draft-04/hostname",
|
|
6
|
-
handler: (hostname) => typeof hostname !== "string" ||
|
|
6
|
+
handler: (hostname) => typeof hostname !== "string" || isHostname(hostname)
|
|
7
7
|
};
|
|
@@ -12,7 +12,7 @@ const compile = async (schema, _ast, parentSchema) => {
|
|
|
12
12
|
const propertyNames = Browser.typeOf(propertiesSchema) === "object" ? Browser.keys(propertiesSchema) : [];
|
|
13
13
|
|
|
14
14
|
const required = new Set(propertyNames);
|
|
15
|
-
requireAllExcept.forEach((propertyName) =>
|
|
15
|
+
requireAllExcept.forEach((propertyName) => required.delete(propertyName));
|
|
16
16
|
return [...required];
|
|
17
17
|
};
|
|
18
18
|
|
package/lib/pubsub.js
CHANGED
|
@@ -16,25 +16,12 @@ export const unsubscribe = (message, token) => {
|
|
|
16
16
|
delete subscriptions[message][token];
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export const publish = (message, data) => {
|
|
20
|
-
for (const subscribedMessage in subscriptions) {
|
|
21
|
-
if (subscribedMessage === message || message.startsWith(`${subscribedMessage}.`)) {
|
|
22
|
-
for (const subscriptionId in subscriptions[subscribedMessage]) {
|
|
23
|
-
subscriptions[subscribedMessage][subscriptionId](message, data);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
19
|
export const publishAsync = async (message, data) => {
|
|
30
20
|
const promises = [];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
promises.push(subscriptions[message][subscriptionId](message, data));
|
|
35
|
-
}
|
|
21
|
+
if (message in subscriptions) {
|
|
22
|
+
for (const subscriptionId in subscriptions[message]) {
|
|
23
|
+
promises.push(subscriptions[message][subscriptionId](message, data));
|
|
36
24
|
}
|
|
37
25
|
}
|
|
38
|
-
|
|
39
26
|
await Promise.all(promises);
|
|
40
27
|
};
|