Why does this error pop up in the slash command thing? - node.js

this is the slash command:
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
await lib.discord.commands['#0.0.0'].create({
"guild_id": "1018895233003569193",
"name": "submit-hw",
"description": "trimite tema",
"options": [
{
"type": 3,
"name": "materie",
"description": "",
"choices": [
{
"name": "romana",
"value": "romana"
},
{
"name": "mate",
"value": "mate"
},
{
"name": "religie",
"value": "religie"
},
{
"name": "engleza",
"value": "engleza"
},
{
"name": "franceza",
"value": "franceza"
},
{
"name": "desen",
"value": "desen"
},
{
"name": "sport",
"value": "sport"
},
{
"name": "biologie",
"value": "biologie"
},
{
"name": "fizica",
"value": "fizica"
},
{
"name": "tic",
"value": "tic"
},
{
"name": "istorie",
"value": "istorie"
},
{
"name": "chimie",
"value": "chimie"
},
{
"name": "consiliere",
"value": "consiliere"
},
{
"name": "sociala",
"value": "sociala"
},
{
"name": "optional",
"value": "optional"
},
{
"name": "tehnologica",
"value": "tehnologica"
},
{
"name": "geografie",
"value": "geografie"
},
{
"name": "muzica",
"value": "muzica"
}
],
"required": true
},
{
"type": 3,
"name": "deadline",
"description": "",
"required": true
},
{
"type": 3,
"name": "tema",
"description": "",
"required": true
}
]
});
and this is the error
It says:
Sorry, could not save you slash commands: Invalid Form Body: code 50035:
Can someone help me out? I wrote all of the command options in the ui text boxes, not as code. SO won't let me post this without more string of text thats not code and i have no idea what to type.....

Description is required for all slash commands and options, including subcommands and subcommand groups. Just a heads up, Error code 50035 would go into detail to show which part is causing an error, such as one of the options type being incorrect.

Related

No operations defined in spec! && Resolver error Cannot read properties of undefined (reading 'api')

I have this error in my node JS in swagger-ui-express I don`t know how to fix it
enter image description here
this is the code in the index.js file
in this code I`am tryin to call the json file that I make and call it swagger.json
const swaggerUi = require('swagger-ui-express'), swaggerDocument = require('./swagger.json')
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument))
that the pic of the beggin of the code
enter image description here
but I`am think that the error is here in this json file
"paths": {
"/api/category": {
"tages": [
"Category"
],
"summery": [
"Get all Categories"
],
"parameters": [
{
"name": "categoryName",
"in": "query",
"required": false,
"description": "Category name",
"type": "string"
},
{
"name": "page",
"in": "query",
"required": false,
"description": "Page Number",
"type": "integer",
"default": 1
},
{
"name": "PageSize",
"in": "query",
"required": false,
"type": "integer",
"default": 10
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ServiceResponse"
}
}
}
},
"post": {
"tages": [
"Category"
],
"summery": "Create Category API",
"parameters": [
{
"name": "categoryName",
"in": "formDate",
"descripition": "Category Name",
"required": true,
"type": "string"
},
{
"name": "CategoryDescription",
"in": "formDate",
"descripition": "Category Description",
"type": "string"
},
{
"name": "Category Image",
"in": "formDate",
"descripition": "Category Image",
"type": "file"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ServiceResponse"
}
}
}
}
},
There are some typos and syntax errors:
The "/api/category" path is missing the "get": node that would wrap the GET operation definition. It should look like this:
"paths": {
"/api/category": {
"get": {
"tags": ...
"tages" should be "tags".
"summery": [...] should be replaced with:
"summary": "Get all Categories",
"in": "formDate" should be "in": "formData" ("a" at the end).
"descripition" should be "description".
Paste your OpenAPI JSON into https://editor.swagger.io - it will show all errors.

Logic App deployed via ARM Template with custom connector (SOAP Passthrough) not configured properly

I have a logic app which contains an action that is using a custom connector. Custom connector is a SOAP Pass through.
Everything is being deployd via ARM Template. When I deploy, everything looks OK except the action for custom connector. It says 'Connector not found'. But If i delete that and add a new action from Logic App designer, everything seems to work as it should. So I believe, the custom connector and api connections are being setup properly but for some reason the action is not setup properly.
Connector is a SOAP Passthrough configured to use on-premises data gateway.
Here is ARM Template (I have removed sensitive information)
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logicAppName": {
"type": "string",
"metadata": {
"description": "Name of the Logic App."
},
"defaultValue": "TestLogicAppCustomConnector"
},
"logicAppLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"allowedValues": [
"[resourceGroup().location]",
"eastasia",
"southeastasia",
"centralus",
"eastus",
"eastus2",
"westus",
"northcentralus",
"southcentralus",
"northeurope",
"westeurope",
"japanwest",
"japaneast",
"brazilsouth",
"australiaeast",
"australiasoutheast",
"southindia",
"centralindia",
"westindia",
"canadacentral",
"canadaeast",
"uksouth",
"ukwest",
"westcentralus",
"westus2"
],
"metadata": {
"description": "Location of the Logic App."
}
},
"customApis_RemedyConnector_name": {
"type": "string",
"defaultValue": "remedyconnector"
},
"connections_RemedyConnector_name": {
"type": "string",
"defaultValue": "RemedyPassThroughConnection"
},
"connections_RemedyConnector_DisplayName": {
"type": "string",
"defaultValue": "Remedy PassThrough SOAP Connection"
},
"remedy_Host": {
"type": "string",
"defaultValue": "server.company.com:8080"
},
"remedy_Base_Path": {
"type": "string",
"defaultValue": "/service"
},
"remedy_username": {
"type": "string",
"defaultValue": "username"
},
"remedy_password": {
"type": "string",
"defaultValue": "pwd"
},
"onPremDataGateway_name": {
"type": "string",
"defaultValue": "on-prem-gateway"
},
"onPremDataGatewayRG_name": {
"type": "string",
"defaultValue": "gateway-rg"
}
},
"variables": {
"remedy_webservice_full_url": "[concat('http://',parameters('remedy_Host'),parameters('remedy_Base_Path'))]"
},
"resources": [
{
"type": "Microsoft.Web/customApis",
"apiVersion": "2016-06-01",
"name": "[parameters('customApis_RemedyConnector_name')]",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "RemedyCustomConnector"
},
"properties": {
"connectionParameters": {
"username": {
"type": "securestring",
"uiDefinition": {
"displayName": "userName",
"description": "The userName for this api",
"tooltip": "Provide the userName",
"constraints": {
"tabIndex": 2,
"clearText": true,
"required": "true",
"capability": [
"gateway"
]
}
}
},
"password": {
"type": "securestring",
"uiDefinition": {
"displayName": "password",
"description": "The password for this api",
"tooltip": "Provide the password",
"constraints": {
"tabIndex": 3,
"clearText": false,
"required": "true",
"capability": [
"gateway"
]
}
}
},
"authType": {
"type": "string",
"allowedValues": [
{
"value": "basic"
}
],
"uiDefinition": {
"displayName": "Authentication Type",
"description": "Authentication type to connect to your API",
"tooltip": "Authentication type to connect to your API",
"constraints": {
"tabIndex": 1,
"required": "true",
"allowedValues": [
{
"text": "basic",
"value": "basic"
}
],
"capability": [
"gateway"
]
}
}
},
"gateway": {
"type": "gatewaySetting",
"gatewaySettings": {
"dataSourceType": "CustomConnector",
"connectionDetails": []
},
"uiDefinition": {
"constraints": {
"tabIndex": 4,
"required": "true",
"capability": [
"gateway"
]
}
}
}
},
"description": "SOAP pass-through for Remedy Calls",
"displayName": "[parameters('customApis_RemedyConnector_name')]",
"backendService": {
"serviceUrl": "[variables('remedy_webservice_full_url')]"
},
"apiType": "Soap",
"wsdlDefinition": {
"importMethod": "SoapPassThrough"
},
"capabilities": [
"gateway"
],
"swagger": {
"swagger": "2.0",
"info": {
"title": "SOAP pass-through",
"description": "SOAP pass-through for Remedy Calls",
"version": "1.0"
},
"host": "[parameters('remedy_Host')]",
"basePath": "[parameters('remedy_Base_Path')]",
"consumes": [],
"produces": [],
"paths": {
"/SoapPassThrough": {
"post": {
"operationId": "SoapPassThrough",
"parameters": [
{
"name": "server",
"in": "query",
"required": true,
"type": "string",
"default": "servername",
"x-ms-visibility": "important",
"enum": [
"servername"
]
},
{
"name": "webService",
"in": "query",
"required": true,
"type": "string",
"default": "FRIntegration",
"x-ms-visibility": "important",
"enum": [
"FRIntegration"
]
},
{
"name": "Content-Type",
"in": "header",
"required": false,
"type": "string",
"default": "text/xml",
"enum": [
"text/xml"
]
},
{
"name": "SOAPAction",
"in": "header",
"required": false,
"type": "string",
"default": "urn:FRIntegration/OpCreate",
"enum": [
"urn:FRIntegration/OpCreate"
]
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"type": "object",
"properties": {},
"x-ms-visibility": "important"
},
"x-ms-visibility": "important"
}
],
"responses": {
"200": {
"description": "OK"
}
},
"summary": "Update",
"description": "Update Remedy Record",
"x-ms-visibility": "important"
}
}
},
"definitions": {},
"parameters": {},
"responses": {},
"securityDefinitions": {
"basic_auth": {
"type": "basic"
}
},
"security": [],
"tags": [],
"schemes": [
"http"
]
}
}
},
{
"type": "MICROSOFT.WEB/CONNECTIONS",
"apiVersion": "2016-06-01",
"name": "[parameters('connections_RemedyConnector_name')]",
"location": "[parameters('logicAppLocation')]",
"tags": {
"displayName": "RemedyConnection"
},
"properties": {
"api": {
"id": "[resourceId('Microsoft.Web/customApis', parameters('customApis_RemedyConnector_name'))]"
},
"displayName": "[parameters('connections_RemedyConnector_DisplayName')]",
"parameterValues": {
"authType": "Basic",
"userName": "[parameters('remedy_username')]",
"password": "[parameters('remedy_password')]",
"gateway": {
"id": "[concat(subscription().id, '/resourceGroups/',parameters('onPremDataGatewayRG_name'),'/providers/Microsoft.Web/connectionGateways/',parameters('onPremDataGateway_name'))]"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/customApis', parameters('customApis_RemedyConnector_name'))]"
]
},
{
"name": "[parameters('logicAppName')]",
"type": "Microsoft.Logic/workflows",
"location": "[parameters('logicAppLocation')]",
"apiVersion": "2016-06-01",
"tags": {
"displayName": "Test-LogicApp-CustomConnector"
},
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose_Soap_Envelope": {
"inputs": "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:FRIntegration\"><soapenv:Header></soapenv:Header><soapenv:Body><urn:OpCreate></urn:OpCreate></soapenv:Body></soapenv:Envelope>",
"runAfter": {
},
"type": "Compose"
},
"Scope": {
"actions": {
"get_all": {
"inputs": {
"body": "#outputs('Compose_Soap_Envelope')",
"headers": {
"Content-Type": "text/xml",
"SOAPAction": "urn:FRIntegration/OpCreate"
},
"host": {
"connection": {
"name": "#parameters('$connections')['RemedyPassThrough']['connectionId']"
}
},
"method": "post",
"path": "/SoapPassThrouh",
"queries": {
"server": "<server>",
"webService": "FRIntegration"
},
"retryPolicy": {
"type": "none"
},
"authentication": {
"type": "Basic"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"runAfter": {
"Compose_Soap_Envelope": [
"Succeeded"
]
},
"type": "Scope"
},
"Compose": {
"inputs": {
"IncidentID": "INC0001",
"RequestStatus": "Fault Investigation",
"WorkLogID": "WorkLogID"
},
"runAfter": {
"Scope": [
"Succeeded"
]
},
"type": "Compose"
},
"Response": {
"inputs": {
"body": "#outputs('Compose')",
"headers": {
"Content-Type": "application/json"
},
"schema": {
"properties": {
"incidentID": {
"type": "string"
},
"requestStatus": {
"type": "string"
},
"workLogID": {
"type": "string"
}
},
"type": "object"
},
"statusCode": 201
},
"kind": "Http",
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "Response"
}
},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {
"type": "object",
"properties": {
"workLogId": {
"type": "object",
"properties": {
"workLogDateTime": {
"type": "string"
},
"workLogDescription": {
"type": "string"
}
}
}
}
},
"method": "POST"
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"RemedyPassThrough": {
"connectionId": "[resourceId('Microsoft.Web/connections', parameters('connections_RemedyConnector_name'))]",
"connectionName": "[parameters('connections_RemedyConnector_name')]",
"id": "[resourceId('Microsoft.Web/customApis', parameters('customApis_RemedyConnector_name'))]"
}
}
}
}
},
"resources": [
],
"dependsOn": [
"[resourceId('Microsoft.Web/customApis', parameters('customApis_RemedyConnector_name'))]",
"[resourceId('Microsoft.Web/connections', parameters('connections_RemedyConnector_name'))]"
]
}
]
}
I've also downloaded and compared the ARM Template for the logic app that i designed in the designer but I don't find any differences. I would appreciate any help/pointers to sort this out.
Thanks
Sanjay

Unable to parse list of Json blocks in U-SQL

I have a file with list of json blocks and am stuck with processing/Reading them in U-Sql and writing to a text file.
{
"id": "0001",
"type": "donut",
"name": "Cake",
"ppu": 0.55,
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" },
{ "id": "1003", "type": "Blueberry" },
{ "id": "1004", "type": "Devil's Food" }
]
},
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" },
{ "id": "5005", "type": "Sugar" },
{ "id": "5007", "type": "Powdered Sugar" },
{ "id": "5006", "type": "Chocolate with Sprinkles" },
{ "id": "5003", "type": "Chocolate" },
{ "id": "5004", "type": "Maple" }
]
}
{
"id": "0002",
"type": "nut",
"name": "ake",
"ppu": 1.55,
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" },
{ "id": "1003", "type": "Blueberry" },
{ "id": "1004", "type": "Devil's Food" }
]
},
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" },
{ "id": "5005", "type": "Sugar" },
{ "id": "5007", "type": "Powdered Sugar" },
{ "id": "5006", "type": "Chocolate with Sprinkles" },
{ "id": "5003", "type": "Chocolate" },
{ "id": "5004", "type": "Maple" }
]
}
{
"id": "0003",
"type": "test",
"name": "ake",
"ppu": 1.55,
"batters":
{
"batter":
[
]
},
"topping":
[
{ "id": "5003", "type": "Chocolate" },
{ "id": "5004", "type": "Maple" }
]
}
can someone help me on this.
REFERENCE ASSEMBLY [Newtonsoft.Json];
REFERENCE ASSEMBLY [Microsoft.Analytics.Samples.Formats];
DECLARE #Full_Path string = #"C:\Users\test\Desktop\File\JsonTest.json";
USING [Microsoft.Analytics.Samples.Formats];
#RawExtract =
EXTRACT
[RawString] string
FROM
#Full_Path
USING
Extractors.Text(delimiter:'\n', quoting : false);
#ParsedJSONLines =
SELECT JsonFunctions.JsonTuple([RawString]) AS JSONLine
FROM #RawExtract;
#StagedData =
SELECT
JSONLine["id"] AS Id,
JSONLine["name"] AS Name,
JSONLine["type"] AS Type,
JSONLine["ppu"] AS PPU,
JSONLine["batters"] AS Batter
FROM
#ParsedJSONLines;
DECLARE #Output_Path string = #"C:\Users\Test\Desktop\File\Test2.csv";
OUTPUT #StagedData
TO #Output_Path
USING Outputters.Csv();
Am receiving error while evaluating expression .
Error while evaluating expression JsonFunctions.JsonTuple(RawString)
You cant use an Text Extraxtor to extract Json, unless you use Json Lines.
Using the extractor will split the json and you will get the error.
Use JsonExtractor instead of Text extractor.
https://github.com/Azure/usql/blob/master/Examples/DataFormats/Microsoft.Analytics.Samples.Formats/Json/JsonExtractor.cs

ARM Template for Azure Custom Connector using On-Premises Data Gateway

I am trying to make an ARM Template for a Custom Connector which needs to have enabled the use of on-premises Data Gateway. I am getting everything right except this last requirement, since I create a fully configured Custom Connector, except for the fact that the check-mark for using the on-premises Data Gateway is not active.
Any idea which setting/element I need to add change to get this done?
This is my template up to now:
{
"type": "Microsoft.Web/customApis",
"name": "[parameters('Connection_Name')]",
"apiVersion": "2016-06-01",
"location": "centralus",
"scale": null,
"properties": {
"connectionParameters": {
"authType": {
"type": "string",
"allowedValues": [
{
"value": "none"
}
],
"uiDefinition": {
"displayName": "Authentication Type",
"description": "Authentication type to connect to your API",
"tooltip": "Authentication type to connect to your API",
"constraints": {
"tabIndex": 1,
"required": "true",
"allowedValues": [
{
"text": "none",
"value": "anonymous"
}
],
"capability": [
"gateway"
]
}
}
},
"gateway": {
"type": "gatewaySetting",
"gatewaySettings": {
"dataSourceType": "CustomConnector",
"connectionDetails": []
},
"uiDefinition": {
"constraints": {
"tabIndex": 4,
"required": "true",
"capability": [
"gateway"
]
}
}
}
},
"backendService": {
"serviceUrl": "[parameters('ServiceUrl')]"
},
"apiType": "Soap",
"wsdlDefinition": {
"importMethod": "SoapPassThrough"
},
"swagger": {
"swagger": "2.0",
"info": {
"title": "SOAP pass-through",
"description": "Custom Connector for SOAP Operation",
"version": "1.0"
},
"host": "xxxxxxxxxxxxx",
"basePath": "/xxxxxxxx/xxxxxxxxxx",
"consumes": [],
"produces": [],
"paths": {
"/": {
"post": {
"responses": {
"default": {
"description": "default",
"schema": {
"type": "string",
"title": "",
"x-ms-visibility": "important"
},
"headers": {
"Content-Type": {
"description": "Content-Type",
"type": "string"
}
}
}
},
"summary": "GetOrigins",
"description": "GetOrigins",
"operationId": "GetOrigins",
"parameters": [
{
"name": "Content-Type",
"in": "header",
"required": false,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": false,
"schema": {
"type": "string"
}
}
]
}
}
},
"definitions": {},
"parameters": {},
"responses": {},
"securityDefinitions": {},
"security": [],
"tags": [],
"schemes": [
"http"
]
},
"description": "[concat('Custom Connector for SOAP', parameters('Connection_Name'),' Operation')]",
"displayName": "[parameters('Connection_Name')]",
"iconUri": "/Content/retail/assets/default-connection-icon.6296199fc1d74aa45ca68e1253762025.2.svg"
},
"dependsOn": []
}
To enable the 'On-Premises Data Gateway' option, you need to add gateway to the capabilities array like so:
"properties" {
"capabilities": [
"gateway"
],
}
the On-Premises Data Gateway option is not available from ARM templates, you must to install your template and manually add the check box from the Azure portal.
Thanks.

Passing parameter to azure adf pipelines using config file by activity name

I have below config file which pass parameter to ADF pipelines according to activity number. but I want, it should pass according to activity name hence
if I reordered the pipeline I need not to reconfigure my config file beacuse then it will identify according to activity name.
"PL_DATA_IL_Omni_Attend": [
{
"name": "$.properties.start",
"value": "2016-02-08T19:00:00Z"
},
{
"name": "$.properties.end",
"value": "2016-02-08T19:00:00Z"
},
{
"name": "$.properties.activities[0].typeProperties.rootPath",
"value": "container/realtime/"
},
{
"name": "$.properties.activities[0].typeProperties.entryFilePath",
"value": "batchprocessor.jar"
},
{
"name": "$.properties.activities[0].typeProperties.className",
"value": "com.cdp.batch.processor.XMLFilesProcessorToBlob"
},
{
"name": "$.properties.activities[0].typeProperties.arguments[0]",
"value": "dev"
},
{
"name": "$.properties.activities[0].typeProperties.arguments[1]",
"value": "Attend"
},
{
"name": "$.properties.activities[0].typeProperties.arguments[2]",
"value": "DELETE_STG"
},
{
"name": "$.properties.activities[1].typeProperties.rootPath",
"value": "container/realtime/"
},
{
"name": "$.properties.activities[1].typeProperties.entryFilePath",
"value": "batchprocessor.jar"
},
{
"name": "$.properties.activities[1].typeProperties.className",
"value": "com.processor.XMLFilesProcessorToBlob"
},
{
"name": "$.properties.activities[1].typeProperties.arguments[0]",
"value": "dev"
},
{
"name": "$.properties.activities[1].typeProperties.arguments[1]",
"value": "Attend"
},
{
"name": "$.properties.activities[1].typeProperties.arguments[2]",
"value": "READWRITE"
},
{
"name": "$.properties.activities[3].typeProperties.rootPath",
"value": "container/realtime"
},
{
"name": "$.properties.activities[3].typeProperties.entryFilePath",
"value": "batchprocessor.jar"
},
]
I want something like below
{
"name": "$.properties.activities[Name of the activity].typeProperties.rootPath",
"value": "container/realtime/"
},
Sudeep, are you using ADF V1 or ADF V2? We just launched V2 of our product which allows for parameter passing.
An example of an ADF V2 pipeline with parameters here: https://learn.microsoft.com/en-us/azure/data-factory/tutorial-control-flow#create-a-data-factory

Resources