@jambonz/schema 0.1.4 → 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
@@ -87,9 +87,19 @@ function validateVerb(name, data, logger) {
87
87
  const valid = validate(verbObj);
88
88
  if (!valid) {
89
89
  const errors = validate.errors || [];
90
- const messages = errors.map((e) => `${e.instancePath || '/'}: ${e.message}`).join('; ');
91
- debug(`validation failed for ${name}: ${messages}`);
92
- throw new Error(`${name}: ${messages}`);
90
+ const details = errors.map((e) => {
91
+ const path = e.instancePath || '(root)';
92
+ let msg = `'${path}': ${e.message}`;
93
+ if (e.params) {
94
+ if (e.params.type) msg += ` (expected ${e.params.type})`;
95
+ if (e.params.allowedValues) msg += ` (allowed: ${e.params.allowedValues.join(', ')})`;
96
+ if (e.params.missingProperty) msg += ` (missing: ${e.params.missingProperty})`;
97
+ }
98
+ return msg;
99
+ }).join('; ');
100
+ const errMsg = `verb '${name}' validation failed — ${details}. Schema: ${schemaId}`;
101
+ debug(errMsg);
102
+ throw new Error(errMsg);
93
103
  }
94
104
  }
95
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/schema",
3
- "version": "0.1.4",
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": {
@@ -108,16 +108,19 @@
108
108
  ]
109
109
  },
110
110
  "listen": {
111
- "$ref": "listen",
112
- "description": "Nested listen verb streams audio of the bridged call to a websocket endpoint."
111
+ "type": "object",
112
+ "description": "Nested listen configuration for streaming audio of the bridged call.",
113
+ "additionalProperties": true
113
114
  },
114
115
  "stream": {
115
- "$ref": "stream",
116
- "description": "Nested stream verb streams audio of the bridged call. Alias for 'listen'."
116
+ "type": "object",
117
+ "description": "Nested stream configuration for streaming audio of the bridged call. Alias for 'listen'.",
118
+ "additionalProperties": true
117
119
  },
118
120
  "transcribe": {
119
- "$ref": "transcribe",
120
- "description": "Nested transcribe verb enables real-time transcription of the bridged call."
121
+ "type": "object",
122
+ "description": "Nested transcribe configuration for real-time transcription of the bridged call.",
123
+ "additionalProperties": true
121
124
  },
122
125
  "timeLimit": {
123
126
  "type": "number",
@@ -117,12 +117,14 @@
117
117
  "description": "Override the session-level STT configuration for this gather."
118
118
  },
119
119
  "say": {
120
- "$ref": "say",
121
- "description": "A nested 'say' verb to use as the prompt. Played to the caller while listening for input."
120
+ "type": "object",
121
+ "description": "A nested say prompt played to the caller while listening for input. Accepts the same properties as the say verb (text, synthesizer, etc.) but no fields are required.",
122
+ "additionalProperties": true
122
123
  },
123
124
  "play": {
124
- "$ref": "play",
125
- "description": "A nested 'play' verb to use as the prompt. Played to the caller while listening for input."
125
+ "type": "object",
126
+ "description": "A nested play prompt played to the caller while listening for input. Accepts the same properties as the play verb (url, etc.) but no fields are required.",
127
+ "additionalProperties": true
126
128
  },
127
129
  "fillerNoise": {
128
130
  "$ref": "../components/fillerNoise",
@@ -76,7 +76,7 @@
76
76
  "default": false
77
77
  }
78
78
  },
79
- "additionalProperties": false
79
+ "additionalProperties": true
80
80
  },
81
81
  "noResponseTimeout": {
82
82
  "type": "number",