Validates SAC custom widget JSON metadata and JavaScript structure for correctness and best practices
Validates SAP Analytics Cloud custom widget JSON metadata and JavaScript structure for schema compliance and best practices
/plugin marketplace add secondsky/sap-skills/plugin install sap-sac-custom-widget@sap-skillsfile_pathValidate SAP Analytics Cloud custom widget files (widget.json and widget.js) for schema compliance, required fields, and best practices.
/widget-validate [file_path]
/widget-validate widget.json
/widget-validate src/widget.js
/widget-validate --all
Required Root Fields:
id - Unique identifier (reverse domain notation: com.company.widget)version - Semantic version (1.0.0)name - Display namevendor - Company/author namewebcomponents - Array of component definitionsRequired webcomponents Fields:
kind - Component type (main, styling, builder)tag - HTML custom element tag (lowercase with hyphens)url - JavaScript file URLOptional but Recommended:
description - Widget descriptionlicense - License typeicon - Widget icon pathintegrity - SHA256 hash for productionproperties - Property definitionsmethods - Script-callable methodsevents - Custom eventsdataBindings - Data binding configurationRequired Elements:
customElements.define() call matching tag in JSONattachShadow({ mode: "open" }) for Shadow DOMRequired Lifecycle Functions:
onCustomWidgetBeforeUpdate(changedProperties)onCustomWidgetAfterUpdate(changedProperties)Recommended Lifecycle Functions:
onCustomWidgetResize()onCustomWidgetDestroy()Property Patterns:
propertiesChanged event dispatch on setIf dataBindings is defined:
feeds arrayid, description, typedimension, mainStructureMember, measureProduction Readiness:
ignoreIntegrity should be false for productionintegrity hash should be present and validWarning-Level:
ignoreIntegrity: true (development only)## SAC Widget Validation Report
**File**: [filename]
**Type**: [widget.json / widget.js]
**Status**: [PASS / FAIL / WARNINGS]
### Critical Issues (X found)
1. [Line X]: [Issue description]
**Current**: `[problematic code]`
**Required**: `[correct pattern]`
### Warnings (X found)
1. [Line X]: [Issue description]
**Recommendation**: [How to fix]
### Suggestions (X found)
1. [Issue description]
**Best Practice**: [Recommendation]
### Summary
- Critical: X (must fix)
- Warnings: X (should fix)
- Suggestions: X (consider)
### Cross-Validation
[Results of JSON ↔ JS consistency check if applicable]
/widget-validate widget.json
/widget-validate widget.js
/widget-validate --all
// GOOD: lowercase with hyphens
"tag": "my-custom-widget"
// BAD: uppercase or underscores
"tag": "MyCustomWidget"
"tag": "my_custom_widget"
// Valid types
"type": "string"
"type": "integer"
"type": "number"
"type": "boolean"
"type": "array"
"type": "object"
"type": "Color" // SAC special type
"type": "Selection" // SAC special type
// REQUIRED - will fail validation if missing
onCustomWidgetBeforeUpdate(changedProperties) { }
onCustomWidgetAfterUpdate(changedProperties) { }
// RECOMMENDED - warning if missing
onCustomWidgetResize() { }
onCustomWidgetDestroy() { }
// Tag in widget.json
"tag": "my-widget"
// Must match in widget.js
customElements.define("my-widget", MyWidget);
When this command is invoked:
--all, find all widget.json and widget.js files in the project