### Install pytest Source: https://github.com/microsoft/json-schemas/blob/main/tests/README.md Install the pytest framework using pip. This is a prerequisite for running the automated tests. ```powershell pip install pytest ``` -------------------------------- ### Run Pytest Schema Validation Tests Source: https://context7.com/microsoft/json-schemas/llms.txt This Python script uses pytest to validate JSON schemas. It checks for the existence of referenced files, ensures '$id' properties start with the correct URL prefix, and verifies the presence of valid '$schema' keywords. Run with: pytest tests/validate-fabric-schemas_test.py -v. ```python # tests/validate-fabric-schemas_test.py — run with: pytest tests/validate-fabric-schemas_test.py -v import json, os, pytest SCHEMA_DIR = "fabric" def find_json_files(root_dir): for dirpath, _, filenames in os.walk(root_dir): for filename in filenames: if filename.endswith(".json"): yield os.path.join(dirpath, filename) @pytest.mark.parametrize("json_file", list(find_json_files(SCHEMA_DIR))) def test_refs_exist(json_file): # Verifies all relative $ref paths point to existing files with open(json_file, "r", encoding="utf-8") as f: schema = json.load(f) base_path = os.path.dirname(json_file) for ref_path in extract_refs(schema, base_path): assert os.path.isfile(ref_path), f"Missing $ref target in {json_file}: {ref_path}" @pytest.pytest.mark.parametrize("json_file", list(find_json_files(SCHEMA_DIR))) def test_id_properties_exist(json_file): # Ensures $id starts with the canonical published URL prefix with open(json_file, "r", encoding="utf-8") as f: schema = json.load(f) assert "$id" in schema assert schema["$id"].startswith("https://developer.microsoft.com/json-schemas/"), \ f"Bad $id in {json_file}: {schema['$id']}" @pytest.mark.parametrize("json_file", list(find_json_files(SCHEMA_DIR))) def test_schema_properties_exist(json_file): # Ensures $schema keyword is present and valid with open(json_file, "r", encoding="utf-8") as f: schema = json.load(f) assert "$schema" in schema assert schema["$schema"].startswith("http://json-schema.org/") or \ schema["$schema"].startswith("https://json-schema.org/") ``` -------------------------------- ### Configure Heft Build System Events Source: https://context7.com/microsoft/json-schemas/llms.txt Sets up event-driven build actions for Heft, including file deletions and copies, within a Rush monorepo context. Ensure the 'extends' path is correctly configured for your project. ```json // .heft/heft.json { "$schema": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json", "extends": "@rushstack/heft-node-rig/profiles/default/config/heft.json", "eventActions": [ { "actionKind": "deleteGlobs", "heftEvent": "clean", "actionId": "cleanDist", "globsToDelete": ["dist", "temp"] }, { "actionKind": "copyFiles", "heftEvent": "compile", "actionId": "copyAssets", "copyOperations": [ { "sourceFolder": "src/assets", "destinationFolders": ["dist/assets"], "includeGlobs": ["**/*.png", "**/*.svg"] } ] } ] } ``` -------------------------------- ### Run all JSON schema validation tests Source: https://github.com/microsoft/json-schemas/blob/main/tests/README.md Execute all available JSON schema validation tests. This command runs the main test file. ```bash pytest tests/validate-fabric-schemas_test.py ``` -------------------------------- ### SPFx Build - Package Solution Configuration Source: https://context7.com/microsoft/json-schemas/llms.txt Validates the `package-solution.json` file for the SPFx toolchain. Controls solution identity, features, assets, and deployment targets. ```json // config/package-solution.json { "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json", "solution": { "name": "contoso-solution-client-side-solution", "id": "11111111-2222-3333-4444-555555555555", "version": "1.0.0.0", "includeClientSideAssets": true, "skipFeatureDeployment": true, "isDomainIsolated": false, "developer": { "name": "Contoso", "websiteUrl": "https://contoso.com", "privacyUrl": "https://contoso.com/privacy", "termsOfUseUrl": "https://contoso.com/terms", "mpnId": "0000000" } }, "paths": { "zippedPackage": "solution/contoso-solution.sppkg" } } ``` -------------------------------- ### Run JSON schema tests with detailed failure information Source: https://github.com/microsoft/json-schemas/blob/main/tests/README.md Execute all JSON schema validation tests with very verbose output, including detailed failure information. This is useful for debugging test failures. ```bash pytest tests/validate-fabric-schemas_test.py -vv ``` -------------------------------- ### Configure Rush Monorepo Settings Source: https://context7.com/microsoft/json-schemas/llms.txt Defines monorepo configuration for Rush, including package manager, Node.js versions, project structure, Git policies, and package review workflows. ```json // rush.json { "$schema": "https://developer.microsoft.com/json-schemas/rush/rush.schema.json", "rushVersion": "5.140.0", "pnpmVersion": "9.0.0", "nodeSupportedVersionRange": ">=18.0.0 <21.0.0", "projectFolderMinDepth": 1, "projectFolderMaxDepth": 2, "approvedPackagesPolicy": { "reviewCategories": ["production", "dev-tools"], "ignoredNpmScopes": ["@types"] }, "gitPolicy": { "allowedEmailRegExps": ["[^@]+@contoso\.com"], "sampleEmail": "developer@contoso.com" }, "repository": { "url": "https://github.com/contoso/monorepo", "defaultBranch": "main" }, "projects": [ { "packageName": "@contoso/shared-ui", "projectFolder": "libraries/shared-ui" }, { "packageName": "@contoso/api-client", "projectFolder": "libraries/api-client" }, { "packageName": "@contoso/web-app", "projectFolder": "apps/web-app" } ] } ``` -------------------------------- ### Run JSON schema tests with verbose output Source: https://github.com/microsoft/json-schemas/blob/main/tests/README.md Run all JSON schema validation tests with verbose output enabled. This provides more detailed information during test execution. ```bash pytest tests/validate-fabric-schemas_test.py -v ``` -------------------------------- ### Teams Toolkit `teamsapp.yml` Configuration Source: https://context7.com/microsoft/json-schemas/llms.txt This YAML file configures the Teams Toolkit for creating, provisioning, deploying, and publishing Teams applications. It defines steps for creating Teams apps, AAD apps, deploying ARM templates, running npm commands, and publishing the app package. ```yaml version: v1.11 projectId: "my-teams-app-project-id" environmentFolderPath: ./env provision: - uses: teamsApp/create with: name: ContosoApp-${{TEAMSFX_ENV}} writeToEnvironmentFile: teamsAppId: TEAMS_APP_ID - uses: aadApp/create with: name: ContosoApp-${{TEAMSFX_ENV}} generateClientSecret: true signInAudience: AzureADMyOrg writeToEnvironmentFile: clientId: AAD_APP_CLIENT_ID clientSecretName: SECRET_AAD_APP_CLIENT_SECRET objectId: AAD_APP_OBJECT_ID tenantId: AAD_APP_TENANT_ID - uses: arm/deploy with: subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} templates: - path: ./infra/azure.bicep parameters: ./infra/azure.parameters.json deploymentName: Create-resources-for-ContosoApp bicepCliVersion: v0.9.1 deploy: - uses: cli/runNpmCommand with: args: install - uses: cli/runNpmCommand with: args: run build - uses: azureStorage/deploy with: workingDirectory: build distributionId: ${{AZURE_STORAGE_RESOURCE_ID}} publish: - uses: teamsApp/zipAppPackage with: manifestPath: ./appPackage/manifest.json outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip outputJsonPath: ./appPackage/build/manifest.${{TEAMSFX_ENV}}.json - uses: teamsApp/publishAppPackage with: appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip writeToEnvironmentFile: publishedAppId: TEAMS_APP_PUBLISHED_APP_ID ``` -------------------------------- ### Configure API Extractor for API Generation Source: https://context7.com/microsoft/json-schemas/llms.txt Configures API Extractor to generate API reports, rollup .d.ts files, and API documentation JSON. Ensure 'entryPointSourceFile' points to your project's main entry point. ```json // api-extractor.json { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json", "compiler": { "configType": "tsconfig", "rootFolder": "." }, "project": { "entryPointSourceFile": "src/index.ts" }, "apiReviewFile": { "enabled": true, "apiReviewFolder": "etc" }, "apiJsonFile": { "enabled": true, "outputFolder": "dist" }, "dtsRollup": { "enabled": true, "publishFolderForInternal": "dist/internal", "publishFolderForBeta": "dist/beta", "publishFolderForPublic": "dist/public" }, "tsdocMetadata": { "enabled": true } } ``` -------------------------------- ### PnP Provisioning Extraction Configuration Schema Source: https://context7.com/microsoft/json-schemas/llms.txt This JSON schema configures the PnP Provisioning Engine for extracting SharePoint site templates. It specifies which components to include, such as lists, pages, navigation, and assets, and their persistence settings. ```json { "$schema": "https://developer.microsoft.com/json-schemas/pnp/provisioning/202102/extract-configuration.schema.json", "version": "1.0", "persistAssetFiles": true, "multiLanguage": { "persistMultiLanguageResources": true, "resourceFilePrefix": "Contoso" }, "pages": { "includeAllClientSidePages": true }, "lists": { "lists": [ { "title": "Announcements", "includeItems": true, "query": "100" } ] }, "navigation": true, "siteFooter": true, "siteHeader": true } ``` -------------------------------- ### Copilot Declarative Agent Schema (v1.6) Source: https://context7.com/microsoft/json-schemas/llms.txt Defines the manifest for Copilot declarative agents, specifying instructions, capabilities like web search or SharePoint integration, and conversation starters. Use this to build custom AI agents for Microsoft 365 Copilot. ```json // declarativeAgent.json — validated against v1.6 { "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.6/schema.json", "version": "v1.6", "name": "Contoso Support Agent", "description": "An AI agent that helps Contoso employees find HR and IT support resources.", "instructions": "You are a helpful support assistant for Contoso. Answer questions about HR policies, IT support tickets, and internal resources. Only use information from the provided SharePoint knowledge sources.", "capabilities": [ { "name": "WebSearch" }, { "name": "OneDriveAndSharePoint", "items_by_sharepoint_ids": [ { "site_id": "contoso.sharepoint.com,abc123,def456", "web_id": "web-guid-here", "list_id": "list-guid-here" } ] } ], "conversation_starters": [ { "title": "Request IT help", "text": "How do I submit an IT support ticket?" }, { "title": "Check vacation policy", "text": "What is the Contoso vacation accrual policy?" } ] } ``` -------------------------------- ### Configure TSDoc Custom Tags and Support Source: https://context7.com/microsoft/json-schemas/llms.txt Defines custom TSDoc tags and configures support for standard TSDoc tags. This schema is used to validate 'tsdoc.json' project configuration files. ```json // config/tsdoc.json { "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", "extends": ["@microsoft/api-extractor/extends/tsdoc-base.json"], "noStandardTags": false, "tagDefinitions": [ { "tagName": "@myCustomTag", "syntaxKind": "block", "allowMultiple": false } ], "supportForTags": { "@alpha": true, "@beta": true, "@public": true, "@internal": true, "@deprecated": true, "@myCustomTag": true, "@virtual": false } } ``` -------------------------------- ### Teams App Manifest Schema (v1.27) Source: https://context7.com/microsoft/json-schemas/llms.txt Defines the structure for Teams application manifests, including app identity, developer info, icons, tabs, bots, and permissions. Ensure the '$schema' property points to the correct version for validation. ```json // manifest.json — Teams app manifest validated against v1.27 { "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.27/MicrosoftTeams.schema.json", "manifestVersion": "1.27", "version": "1.0.0", "id": "00000000-0000-0000-0000-000000000001", "developer": { "name": "Contoso Corp", "websiteUrl": "https://www.contoso.com", "privacyUrl": "https://www.contoso.com/privacy", "termsOfUseUrl": "https://www.contoso.com/terms" }, "name": { "short": "Contoso App", "full": "Contoso Productivity App" }, "description": { "short": "A productivity app for Contoso.", "full": "The Contoso Productivity App integrates your Contoso workflows into Teams." }, "icons": { "color": "color.png", "outline": "outline.png" }, "accentColor": "#FFFFFF", "staticTabs": [ { "entityId": "homeTab", "name": "Home", "contentUrl": "https://contoso.com/tab", "scopes": ["personal"] } ], "permissions": ["identity", "messageTeamMembers"], "validDomains": ["contoso.com"] } ``` -------------------------------- ### Microsoft 365 Copilot API Plugin Manifest Source: https://context7.com/microsoft/json-schemas/llms.txt Defines the manifest for plugins extending Microsoft 365 Copilot with external API capabilities. Ensure the schema version matches your plugin's requirements. ```json // ai-plugin.json — validated against v2.4 { "$schema": "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.4/schema.json", "schema_version": "v2.4", "name_for_human": "Contoso Tasks", "namespace": "contoso-tasks", "description_for_model": "Manage Contoso tasks: create, list, update, and delete tasks for the current user.", "description_for_human": "Manage your Contoso tasks via Copilot.", "contact_email": "support@contoso.com", "legal_info_url": "https://contoso.com/terms", "privacy_policy_url": "https://contoso.com/privacy", "functions": [ { "name": "getTasks", "description": "Retrieves all tasks for the current user.", "parameters": { "type": "object", "properties": { "status": { "type": "string", "description": "Filter by task status: open, completed, or all.", "enum": ["open", "completed", "all"] } } } } ], "runtimes": [ { "type": "OpenApi", "auth": { "type": "OAuthPluginVault" }, "spec": { "url": "https://contoso.com/openapi.yaml" }, "run_for_functions": ["getTasks"] } ] } ``` -------------------------------- ### SharePoint Column Formatting - Conditional Styling Source: https://context7.com/microsoft/json-schemas/llms.txt Applies conditional background and text color to a 'Status' column based on its value. Uses nested ternary operators for styling. ```json // column-formatting.json — color a Status column based on value { "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "style": { "padding": "4px 8px", "border-radius": "4px", "background-color": { "operator": "?", "operands": [ { "operator": "==", "operands": ["[$Status]", "Approved"] }, "#00b288", { "operator": "?", "operands": [ { "operator": "==", "operands": ["[$Status]", "Rejected"] }, "#d13438", "#a19f9d" ] } ] }, "color": "white", "font-weight": "600" }, "txtContent": "[$Status]" } ``` -------------------------------- ### Microsoft Fabric Git Integration Platform Properties Schema Source: https://context7.com/microsoft/json-schemas/llms.txt This JSON schema defines platform properties for Microsoft Fabric Git integration. It includes metadata like the item type and display name, and configuration details such as version and logical ID. ```json { "$schema": "https://developer.microsoft.com/json-schemas/fabric/gitIntegration/platformProperties/2.1.0/schema.json", "metadata": { "type": "Report", "displayName": "Contoso Sales Report" }, "config": { "version": "2.0", "logicalId": "00000000-0000-0000-0000-000000000001" } } ``` -------------------------------- ### Configure VS Code for JSON Schema Validation Source: https://context7.com/microsoft/json-schemas/llms.txt This JSON configuration for VS Code's settings.json maps file patterns to remote schema URLs. This enables IDE validation, autocompletion, and documentation hovers for various Microsoft development artifacts. The yaml.schemas setting provides similar functionality for YAML files. ```json // .vscode/settings.json — map local project files to schemas for IDE validation { "json.schemas": [ { "fileMatch": ["**/manifest.json"], "url": "https://developer.microsoft.com/json-schemas/teams/v1.27/MicrosoftTeams.schema.json" }, { "fileMatch": ["**/*.manifest.json"], "url": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json" }, { "fileMatch": ["**/rush.json"], "url": "https://developer.microsoft.com/json-schemas/rush/rush.schema.json" }, { "fileMatch": ["**/.heft/heft.json"], "url": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json" }, { "fileMatch": ["**/api-extractor.json"], "url": "https://developer.microsoft.com/json-schemas/api-extractor/api-extractor.schema.json" }, { "fileMatch": ["**/tsdoc.json"], "url": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json" }, { "fileMatch": ["**/teamsapp.yml"], "url": "https://developer.microsoft.com/json-schemas/teams-toolkit/teamsapp-yaml/v1.11/yaml.schema.json" } ], "yaml.schemas": { "https://developer.microsoft.com/json-schemas/teams-toolkit/teamsapp-yaml/v1.11/yaml.schema.json": "teamsapp.yml" } } ``` -------------------------------- ### SharePoint Framework (SPFx) Web Part Manifest Source: https://context7.com/microsoft/json-schemas/llms.txt Validates the component manifest JSON for SPFx client-side web parts. Covers identity, preconfigured entries, and loader configuration. ```json // HelloWorldWebPart.manifest.json { "$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json", "id": "3bc7927e-4a5e-4520-b540-71305c79c20b", "alias": "HelloWorldWebPart", "componentType": "WebPart", "version": "*", "manifestVersion": 2, "requiresCustomScript": false, "supportedHosts": ["SharePointWebPart", "TeamsPersonalApp"], "preconfiguredEntries": [ { "groupId": "5c03119e-3074-46fd-976b-c60198311f70", "group": { "default": "Advanced" }, "title": { "default": "Hello World" }, "description": { "default": "A simple hello world web part." }, "officeFabricIconFontName": "Page", "properties": { "description": "Hello World" } } ] } ``` -------------------------------- ### Microsoft Fabric Visual Container Schema Source: https://context7.com/microsoft/json-schemas/llms.txt This JSON schema defines the structure for a visual container within a Microsoft Fabric report. It specifies the visual's type, position, and query configuration. ```json { "$schema": "https://developer.microsoft.com/json-schemas/fabric/item/report/definition/visualContainer/2.7.0/schema.json", "name": "5f8a4b2c9d1e", "position": { "x": 0, "y": 0, "z": 0, "width": 520, "height": 320, "tabOrder": 0 }, "visual": { "visualType": "barChart", "query": { "queryState": { "Category": { "projections": [{ "field": { "Column": { "Expression": { "SourceRef": { "Entity": "Sales" } }, "Property": "Category" } } }] }, "Y": { "projections": [{ "field": { "Measure": { "Expression": { "SourceRef": { "Entity": "Sales" } }, "Property": "Total Revenue" } } }] } } } } } ``` -------------------------------- ### Microsoft Fabric Report Definition Schema Source: https://context7.com/microsoft/json-schemas/llms.txt This JSON schema defines the structure for a Microsoft Fabric report definition. It includes settings for theme, filters, and public custom visuals. ```json { "$schema": "https://developer.microsoft.com/json-schemas/fabric/item/report/definition/report/3.2.0/schema.json", "themeCollection": { "baseTheme": { "name": "CY24SU10", "version": "5.58.0", "type": "SharedResources" } }, "filterConfig": { "filters": [] }, "reportSource": "Default", "publicCustomVisuals": [], "settings": { "useStyledTooltips": true, "defaultDrillFilterOtherVisuals": true } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.