### Example Validation Error Message Source: https://github.com/microsoft/powerbi-desktop-samples/blob/main/Report Theme JSON Schema/README.md An example of a verbose error message received when a theme definition under `visualStyles > * > *` does not match the expected pattern. This message indicates type mismatches and missing required properties. ```text #/visualStyles/*/*/tableEx/0/* must be string,number,boolean (type; matching schema #/properties/visualStyles/additionalProperties/properties/*/patternProperties/%5E.%2B%24/items/patternProperties/%5E.%2B%24/anyOf/0/type) #/visualStyles/*/*/tableEx/0/* must have required property 'reverseDirection' (required; matching schema #/required) #/visualStyles/*/*/tableEx/0/* must have required property 'hideText' (required; matching schema #/required) #/visualStyles/*/*/tableEx/0/* must NOT have additional properties (additionalProperties; matching schema #/additionalProperties) #/visualStyles/*/*/tableEx/0/* must NOT have additional properties (additionalProperties; matching schema #/additionalProperties) #/visualStyles/*/*/tableEx/0/* must have required property 'solid' (required; matching schema #/oneOf/0/required) #/visualStyles/*/*/tableEx/0/* must NOT have additional properties (additionalProperties; matching schema #/oneOf/0/additionalProperties) #/visualStyles/*/*/tableEx/0/* must NOT have additional properties (additionalProperties; matching schema #/oneOf/0/additionalProperties) #/visualStyles/*/*/tableEx/0/* must have required property 'gradient' (required; matching schema #/oneOf/1/required) #/visualStyles/*/*/tableEx/0/* must NOT have additional properties (additionalProperties; matching schema #/oneOf/1/additionalProperties) [... about 30 additional lines follow] ``` -------------------------------- ### Associate Power BI File Extensions with JSON in VS Code Source: https://github.com/microsoft/powerbi-desktop-samples/blob/main/item-schemas/README.md Configure VS Code to recognize specific Power BI file extensions as JSON files, enabling syntax highlighting and basic JSON features. ```json { "files.associations": { "*.pbir": "json" , "*.pbidataset": "json" , "*.pbip": "json" } } ``` -------------------------------- ### Configure VS Code for Power BI JSON Schemas Source: https://github.com/microsoft/powerbi-desktop-samples/blob/main/item-schemas/README.md Add this configuration to your VS Code User settings.json to enable schema validation and Intellisense for various Power BI file types. ```json { "json.schemas": [ { "fileMatch": [ "*.pbidataset" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/dataset/definition.pbidataset-1.0.json" } , { "fileMatch": [ "/*.Dataset/.pbi/editorSettings.json" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/dataset/editorSettings-1.0.json" } , { "fileMatch": [ "/*.Dataset/.pbi/localsettings.json" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/dataset/localSettings-1.0.json" } , { "fileMatch": [ "/*.Dataset/.pbi/unappliedchanges.json" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/dataset/unappliedChanges-1.0.json" } , { "fileMatch": [ "*.pbir" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/report/definition.pbir-1.0.json" } , { "fileMatch": [ "/*.Report/.pbi/localsettings.json" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/report/localSettings-1.0.json" } , { "fileMatch": [ "*.pbip" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/common/pbip-1.0.json" } , { "fileMatch": [ "/*.Report/item.config.json" , "/*.Dataset/item.config.json" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/common/item.config-1.0.json" } , { "fileMatch": [ "/*.Report/item.metadata.json" , "/*.Dataset/item.metadata.json" ], "url": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/item-schemas/common/item.metadata-1.0.json" } ] } ``` -------------------------------- ### Theme Data Color Expression Source: https://github.com/microsoft/powerbi-desktop-samples/blob/main/Report Theme JSON Schema/README.md Use this pattern to reference specific data colors defined in the theme. This is an alternative to redeclaring colors for each visual. ```json { "solid": { "color": { "expr": { "ThemeDataColor": { "ColorId": 2, "Percent": 0 } } } } } ``` -------------------------------- ### Reference Local JSON Schema in VS Code Source: https://github.com/microsoft/powerbi-desktop-samples/blob/main/Report Theme JSON Schema/README.md Use the "$schema" property in your custom theme JSON file to reference a locally downloaded schema file for inline validation and autocomplete. ```json { "$schema": "./reportThemeSchema-2.121.json", "name": "My Custom Theme", "dataColors": [ "#4472C4", "#ED7D31", "#A5A5A5", "#FFC000", "#7030A0" ] } ``` -------------------------------- ### Visual Styles Schema Enforcement Source: https://github.com/microsoft/powerbi-desktop-samples/blob/main/Report Theme JSON Schema/README.md This pattern is enforced under `visualStyles > * > *` to ensure proper structure for visual property definitions. Definitions not matching this type will result in verbose error messages. ```json [ { [propertyName]: number, boolean, string, or other structural type (color fill, themeColorExpr, etc.) }, ... ] ``` -------------------------------- ### Structural Color Reference in Theme Source: https://github.com/microsoft/powerbi-desktop-samples/blob/main/Report Theme JSON Schema/README.md Reference structural colors defined at the top level of the theme. This avoids repeating color definitions for specific visuals. ```json { "solid": { "color": "foreground" } } ``` -------------------------------- ### Reference Remote JSON Schema in VS Code Source: https://github.com/microsoft/powerbi-desktop-samples/blob/main/Report Theme JSON Schema/README.md Alternatively, reference the raw HTML link of the schema directly from the repository. This requires an active internet connection and allows Visual Studio Code to access the remote resource. ```json { "$schema": "https://raw.githubusercontent.com/microsoft/powerbi-desktop-samples/main/Report Theme JSON Schema/reportThemeSchema-2.121.json", "name": "My Custom Theme", "dataColors": [ "#4472C4", "#ED7D31", "#A5A5A5", "#FFC000", "#7030A0" ] } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.