@jambonz/schema 0.1.5 → 0.1.6

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.
@@ -41,9 +41,24 @@
41
41
  },
42
42
  "hints": {
43
43
  "type": "array",
44
- "items": { "type": "string" },
45
- "description": "An array of words or phrases that the recognizer should favor. Use this to improve accuracy for domain-specific terminology, product names, or proper nouns.",
46
- "examples": [["jambonz", "drachtio", "SIP", "WebRTC"]]
44
+ "items": {
45
+ "oneOf": [
46
+ { "type": "string" },
47
+ {
48
+ "type": "object",
49
+ "properties": {
50
+ "phrase": { "type": "string" },
51
+ "boost": { "type": "number" }
52
+ },
53
+ "required": ["phrase"]
54
+ }
55
+ ]
56
+ },
57
+ "description": "An array of words or phrases that the recognizer should favor. Each item can be a plain string or an object with 'phrase' and optional 'boost' properties.",
58
+ "examples": [
59
+ ["jambonz", "drachtio", "SIP", "WebRTC"],
60
+ [{"phrase": "jambonz", "boost": 20}, {"phrase": "drachtio", "boost": 10}]
61
+ ]
47
62
  },
48
63
  "hintsBoost": {
49
64
  "type": "number",
package/lib/validator.js CHANGED
@@ -88,9 +88,8 @@ function validateVerb(name, data, logger) {
88
88
  if (!valid) {
89
89
  const errors = validate.errors || [];
90
90
  const details = errors.map((e) => {
91
- const path = e.instancePath || '/';
92
- const prop = path.split('/').filter(Boolean).pop() || '(root)';
93
- let msg = `property '${prop}': ${e.message}`;
91
+ const path = e.instancePath || '(root)';
92
+ let msg = `'${path}': ${e.message}`;
94
93
  if (e.params) {
95
94
  if (e.params.type) msg += ` (expected ${e.params.type})`;
96
95
  if (e.params.allowedValues) msg += ` (allowed: ${e.params.allowedValues.join(', ')})`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/schema",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "JSON Schema definitions and validation for jambonz verb applications",
5
5
  "main": "index.js",
6
6
  "scripts": {