The settings in VS Code supports graphic panel like below:
I am developing an extension in vscode but I couldn't find a document or example to show how to add these settings. Is there any tutorial I can read for doing that?
I tried below configuration but the GUI doesn't show panel for these fields:
"configuration": [
{
"type": "object",
"title": "MongoDB Runner Configuration",
"properties": {
"mongoRunner": {
"type": "object",
"default": {},
"description": "Complete connection configuration for your MongoDB.",
"properties": {
"connection": {
"title": "MongoDB Runner Configuration",
"type": "object",
"properties": {
"url": {
"type": "string",
"default": "mongodb://",
"description": "MongoDB URI"
},
"activeOnStartUp": {
"type": "boolean",
"default": false,
"description": "whether launch mongodb runner on start up"
}
}
}
}
}
}
}
]
below is the json file format I need to support:
"mongoRunner": {
"connection": {
"activeOnStartUp": true,
"url": "mongodb://localhost:27017"
}
},
Is this what you're looking for?
You can use markdown in the description (property markdownDescription), and the checkbox appears by using type boolean.
Example:
"configuration": {
"type": "object",
"title": "Test configuration",
"properties": {
"test.usingUI": {
"type": "boolean",
"default": false,
"markdownDescription": "**Some bold text**\nYes or no?"
},
"test.text": {
"type": ["string", "null"],
"default": null,
"description": "You can't edit me now!"
}
}
},
Looking in the UI like
this
Edit - 2:
In this case your syntax is malformed, try this:
"configuration": {
"type": "object",
"title": "MongoDB Runner Configuration",
"properties": {
"mongoRunner.url": {
"type": "string",
"default": "mongodb://",
"description": "MongoDB URI"
},
"mongoRunner.activeOnStartUp": {
"type": "boolean",
"default": false,
"description": "whether launch mongodb runner on start up"
}
}
},
-> UI
Related
If my vscode extension contributes the following, how can I disable or hide the my-extension.prop-2 configuration setting when the extension is run using the browser entry?
{
"main": "./out/main.js",
"browser": "./out/browser.js",
"contributes": {
"configuration": {
"title": "My Extension",
"properties": {
"my-extension.prop-1": {
"type": "boolean",
"scope": "machine",
"default": false,
"description": "Property 1"
},
"my-extension.prop-2": {
"type": "boolean",
"scope": "machine",
"default": false,
"description": "Property 2"
}
}
}
}
}
I want to create a function app with ARM template such that the ARM template references already existing storage accounts (inputstgdev and outputstgdev) which I have already parameterized. I would like the ARM template to use the inputstgdev storage account as its attached storage account such that it does not have to create a new storage account. The source control of the function app is referenced to a Gitrepo which I have also parameterized in the ARM template. Each time I run the ARM template I get the following error message
##[error]Deployment template validation failed: 'The resource '/subscriptions/bea8ac84-24a4-4e53-9198-e3b0107547d4/resourceGroups/dev-rgp/providers/Microsoft.Web/sites/functionapp/sourcecontrols/web' at line '1' and column '3069' doesn't depend on parent resource '/subscriptions/bea8ac84-24a4-4e53-9198-e3b0107547d4/resourceGroups/dev-rgp/providers/Microsoft.Web/sites/functionapp'. Please add dependency explicitly using the 'dependsOn' syntax. Please see aka.ms/arm-template/#resources for
Any suggestions what the issue might be or possible solutions.
I look forward to your response
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"InputstorageAccount": {
"defaultValue": "inputstgdev",
"type": "String"
},
"GitrepoBranch": {
"type": "string",
"defaultValue": "master",
"metadata": {
"description": "Name of the branch to use when deploying (Default = master)."
}
},
"GitrepoURL": {
"type": "string",
"defaultValue": "https://github.com/FBoucher/AzUnzipEverything.git",
"metadata": {
"description": "URL to repo (Default = master)."
}
},
"InputcontainerName": {
"type": "string",
"defaultValue": "inputcontainer",
"metadata": {
"description": "Specifies the name of the blob container."
}
},
"OutputstorageAccount": {
"defaultValue": "outputstgdev",
"type": "String"
},
"OutputcontainerName": {
"type": "string",
"defaultValue": "outputcontainer",
"metadata": {
"description": "Specifies the name of the blob container."
}
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2019-06-01",
"name": "[concat(parameters('InputstorageAccount'), '/default/', parameters('InputcontainerName'))]",
"properties": {
"publicAccess": "None"
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2019-06-01",
"name": "[concat(parameters('OutputstorageAccount'), '/default/', parameters('OutputcontainerName'))]",
"properties": {
"publicAccess": "None"
}
},
{
"name": "serviceplan",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "serviceplan"
},
"properties": {
"name": "serviceplan"
}
},
{
"name": "functionapp",
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"location": "[resourceGroup().location]",
"kind": "functionapp",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'serviceplan')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('InputstorageAccount'))]"
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'serviceplan')]",
"siteConfig": {
"appSettings": [
{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('InputstorageAccount'), ';AccountKey=', listKeys(parameters('InputcontainerName'),'2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('InputstorageAccount'), ';AccountKey=', listKeys(parameters('InputcontainerName'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('InputstorageAccount'), ';AccountKey=', listKeys(parameters('InputcontainerName'),'2015-05-01-preview').key1)]"
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "[toLower('functionapp')]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(resourceId('microsoft.insights/components/', 'applicationInsightsName'), '2015-05-01').InstrumentationKey]"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet"
}
]
}
},
"resources":[
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/', parameters('InputstorageAccount'))]"
],
"properties": {
"RepoUrl": "[parameters('GitrepoURL')]",
"branch": "[parameters('GitrepoBranch')]",
"publishRunbook": true,
"IsManualIntegration": true
}
}
]
}
]
}
You encountered this error message due to the wrong dependency.
You should use "[resourceId('Microsoft.Web/sites/', 'functionapp')]" instead of "[resourceId('Microsoft.Web/sites/', parameters('InputstorageAccount'))]".
And you should delete the storage dependency.
"[resourceId('Microsoft.Storage/storageAccounts', parameters('InputstorageAccount'))]"
By the way, as you already have a storage account, you just need to paste your connection string in the value of AzureWebJobsStorage and AzureWebJobsDashboard.
Just like
{
"name": "AzureWebJobsDashboard",
"value": "{connectionstring}"
}
I've created a custom component but the problem is that when I preview or export that component the image aren't exported
{
/* ... */
"attributes": [
{
"name": "bkgmap",
"label": "bkgmap",
"type": "string",
"required": true,
"description": "desc",
"gwdSpecific": {
"label": "bkgmapImg",
"sync": "src"
}
},
{
"name": "bkgback",
"label": "bkgback",
"type": "string",
"required": true,
"description": "desc",
"gwdSpecific": {
"label": "bkgbackImg",
"sync": "src"
}
},
{
"name": "bkgfore",
"label": "bkgfore",
"type": "string",
"required": true,
"description": "desc",
"gwdSpecific": {
"label": "bkgforeImg",
"sync": "src"
}
},
{
"name": "bar",
"label": "bar",
"type": "string",
"required": true,
"description": "desc",
"gwdSpecific": {
"label": "barImg",
"sync": "src"
}
} /* ... */
],
}
In this way, with the sync property I'm able to export only one image, someone know how is it possible to achieve the image inclusion? And also someone know how to set up a file upload type? the attributes type "file" works but isn't possibile to select any file, also if I specify the accept property.
{
"name": "dragIcon",
"label": "Drag Icon",
"type": "file",
"description": "Choose the images",
"required": true,
"accept": "image/*",
"bindable": false
},
I am looking for the official documentation for Azure Desired State Configuration JSON schemas. Documentation and examples I find online go back quite a while and I feel the schemas I am using are not current. I am currently seeking the most current schema and a description of the fields for Microsoft.Powershell.DSC. This is the schema Visual Studio provides but I would like to have a complete understanding of each field and values they expect.
{
"name": "Microsoft.Powershell.DSC",
"type": "extensions",
"location": "[parameters('location')]",
"apiVersion": "2015-06-15",
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines', parameters('vm-SP1-Name'))]"
],
"tags": {
"displayName": "test"
},
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.9",
"autoUpgradeMinorVersion": true,
"forceUpdateTag": "[parameters('testUpdateTagVersion')]",
"settings": {
"configuration": {
"url": "[concat(parameters('_artifactsLocation'), '/', variables('testArchiveFolder'), '/', variables('testArchiveFileName'))]",
"script": "test.ps1",
"function": "Main"
},
"configurationArguments": {
"nodeName": "[parameters('vm-SP1-Name')]"
}
},
"protectedSettings": {
"configurationUrlSasToken": "[parameters('_artifactsLocationSasToken')]"
}
}
}
The official schema definition for the ARM PowerShell Desired State Configuration (DSC) JSON Schema can be found at the link below:
Schema Json
"dscExtension": {
"type": "object",
"properties": {
"publisher": {
"enum": ["Microsoft.Powershell"]
},
"type": {
"enum": ["DSC"]
},
"typeHandlerVersion": {
"type": "string",
"minLength": 1
},
"autoUpgradeMinorVersion": {
"type": "boolean"
},
"settings": {
"type": "object",
"properties": {
"modulesUrl": {
"type": "string"
},
"configurationFunction": {
"type": "string"
},
"properties": {
"type": "string"
},
"wmfVersion": {
"type": "string"
},
"privacy": {
"type": "object",
"properties": {
"dataCollection": {
"type": "string"
}
}
}
},
"required": ["modulesUrl", "configurationFunction"]
},
"protectedSettings": {
"type": "object",
"properties": {
"dataBlobUri": {
"type": "string"
}
}
}
},
"required": ["publisher", "type", "typeHandlerVersion", "autoUpgradeMinorVersion", "settings", "protectedSettings"]
},
The schema was documented in this blog. Feel free to ping me on the PowerShell slack (preferred) or twitter if you have any questions, #TravisPlunk. If I don't know, I can direct them to the right place.
I've tried to import swagger document in json format. I got the error
The field paths["/namespaces"].get.responses["401"] uses a Swagger
jsonReference. This is not supported. Remove this field, or in-line
the referenced JSON instead, and resubmit the request.
(I also attached the screenshot for just incase). The code snippet which might caused the error is like this:
"401": {
"$ref": "#/responses/UnauthorizedRequest"
},
"500": {
"$ref": "#/responses/ServerError"
}
What's wrong with this contents ? Appreciate if you could point me how to fix the problem.
Thanks !
Ref: screenshot
This error looks like a limitation/bug but as the error description suggests, you can in-line the definition to get around it. Here is an example of inlining references in a Swagger document.
The following Swagger document has a $ref
"responses": {
"200": {
"description": "Task retrieved",
"schema": {
"$ref": "#/definitions/Task"
}
},
"404": {
"description": "Task not found"
}
}
...
"definitions": {
"Task": {
"type": "object",
"required": [
"deadline",
"description",
"status"
],
"properties": {
"description": {
"type": "string",
"example": "Make an app for Demo"
},
"status": {
"type": "string",
"example": "Created"
},
"deadline": {
"type": "string",
"format": "date",
"example": "01/15/16"
}
}
}
After inlining the $ref definition, the Swagger document would look like this:
"responses": {
"200": {
"description": "Task retrieved",
"schema": {
"type": "object",
"required": [
"deadline",
"description",
"status"
],
"properties": {
"description": {
"type": "string",
"example": "Make an app for Demo"
},
"status": {
"type": "string",
"example": "Created"
},
"deadline": {
"type": "string",
"format": "date",
"example": "01/15/16"
}
}
}
},
"404": {
"description": "Task not found"
}
}