@jambonz/schema 0.1.3 → 0.1.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/lib/validator.js CHANGED
@@ -87,9 +87,20 @@ 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 || '/';
92
+ const prop = path.split('/').filter(Boolean).pop() || '(root)';
93
+ let msg = `property '${prop}': ${e.message}`;
94
+ if (e.params) {
95
+ if (e.params.type) msg += ` (expected ${e.params.type})`;
96
+ if (e.params.allowedValues) msg += ` (allowed: ${e.params.allowedValues.join(', ')})`;
97
+ if (e.params.missingProperty) msg += ` (missing: ${e.params.missingProperty})`;
98
+ }
99
+ return msg;
100
+ }).join('; ');
101
+ const errMsg = `verb '${name}' validation failed — ${details}. Schema: ${schemaId}`;
102
+ debug(errMsg);
103
+ throw new Error(errMsg);
93
104
  }
94
105
  }
95
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/schema",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "JSON Schema definitions and validation for jambonz verb applications",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -69,16 +69,19 @@
69
69
  "additionalProperties": true
70
70
  },
71
71
  "listen": {
72
- "$ref": "listen",
73
- "description": "Nested listen verb session-level audio streaming configuration."
72
+ "type": "object",
73
+ "description": "Session-level audio streaming configuration defaults. Properties match the listen verb but no fields are required here.",
74
+ "additionalProperties": true
74
75
  },
75
76
  "stream": {
76
- "$ref": "stream",
77
- "description": "Nested stream verb — session-level audio streaming configuration. Alias for 'listen'."
77
+ "type": "object",
78
+ "description": "Session-level audio streaming configuration defaults. Alias for 'listen'.",
79
+ "additionalProperties": true
78
80
  },
79
81
  "transcribe": {
80
- "$ref": "transcribe",
81
- "description": "Nested transcribe verb — session-level real-time transcription configuration."
82
+ "type": "object",
83
+ "description": "Session-level transcription configuration defaults.",
84
+ "additionalProperties": true
82
85
  },
83
86
  "amd": {
84
87
  "$ref": "../components/amd",
@@ -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",