How to display typeorm's listname - node.js-typeorm

{
"school": [
{
"code": "625",
"name": "대덕소프트웨어마이스터고등학교",
"type": "고등학교",
"location": "대전광역시",
"adress": "대전광역시 유성구 가정북로 76",
"phone": "042-866-8822",
"url": "http:",
"division": "특목고",
"image_url": "https://user-images"
}
]
}
desired response value
{
"code": "625",
"name": "대덕소프트웨어마이스터고등학교",
"type": "고등학교",
"location": "대전광역시",
"adress": "대전광역시 유성구 가정북로 76",
"phone": "042-866-8822",
"url": "http:",
"division": "특목고",
"image_url": "https://user-images"
}
current response value
current response value
I want to send it as a response value as above using typeorm. What should I do? I am using typeorm query builder.

Related

Write r GET query from data provided

I have JSON data about R request that i need to write with necessary url, access token, parameters and other things, which must be included in httr query. I got it from getpostman item. Here it is:
{
"name": "GET /tablesbyquery",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "hnjP4YUF-woR0jhUyJIByeOI_q8jF99jK5WlQ", #fake for example
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://somesource.os-pub.com/tables/tablesbyquery?timePeriod=actual&sort=utdDate,asc&query=&isNotEmptyStatus=false&size=20&page=0&providerId=",
"protocol": "http",
"host": [
"somesource",
"os-pub",
"com"
],
"path": [
"tables",
"tablesbyquery"
],
"query": [
{
"key": "timePeriod",
"value": "actual"
},
{
"key": "sort",
"value": "utdDate,asc"
},
{
"key": "query",
"value": ""
},
{
"key": "isNotEmptyStatus",
"value": "false"
},
{
"key": "size",
"value": "20"
},
{
"key": "page",
"value": "0"
},
{
"key": "providerId",
"value": ""
}
]
}
},
"response": []
}
I need to write R request query to GET necessary data. How it should look like? Im new in url and i have written this part:
url <- "http://somesource.os-pub.com/tables/tablesbyquery?timePeriod=actual&sort=utdDate,asc&query=&isNotEmptyStatus=false&size=20&page=0&providerId="
access_token <- "hnjP4YUF-woR0jhUyJIByeOI_q8jF99jK5WlQ"
res <- GET(url, access_token)
content(res, "parsed")
But it doesn't work.

How to get rid of "API must not have local definitions (i.e. only $refs are allowed)" Swaggerhub standardization error with Springfox

I have swagger api-docs.json definition generated by SpringFox.
Below minimal-reproducible-example:
{
"swagger": "2.0",
"info": {
"description": "Example REST API.",
"version": "15.11.02",
"title": "Example REST API",
"contact": {
"name": "ExampleTeam",
"url": "https://example.com/",
"email": "support#example.com"
},
"license": {
"name": "Apache License 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
},
"host": "d01088db.ngrok.io",
"basePath": "/cloud",
"tags": [
{
"name": "All Endpoints",
"description": " "
}
],
"paths": {
"/api/v2/users/{userId}/jobs/{jobId}": {
"get": {
"tags": [
"Builds",
"All Endpoints"
],
"summary": "Get job.",
"operationId": "getJobUsingGET",
"produces": [
"*/*"
],
"parameters": [
{
"name": "jobId",
"in": "path",
"description": "jobId",
"required": true,
"type": "integer",
"format": "int64"
},
{
"name": "userId",
"in": "path",
"description": "userId",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/APIPipelineJob"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"deprecated": false
}
}
},
"definitions": {
"APIPipelineJob": {
"type": "object",
"properties": {
"archiveTime": {
"type": "string",
"format": "date-time",
"example": "example"
},
"content": {
"type": "string",
"example": "example"
},
"createTime": {
"type": "string",
"format": "date-time",
"example": "example"
},
"id": {
"type": "integer",
"format": "int64",
"example": "example"
},
"name": {
"type": "string",
"example": "example"
},
"selfURI": {
"type": "string",
"example": "example"
},
"type": {
"type": "string",
"example": "example",
"enum": [
"BUILD",
"DEPLOY"
]
},
"userId": {
"type": "integer",
"format": "int64",
"example": "example"
}
},
"title": "APIPipelineJob",
"xml": {
"name": "APIPipelineJob",
"attribute": false,
"wrapped": false
}
}
}
}
When I import it to SwaggerHub I got standardization error:
'definitions.*' not allowed -> API must not have local definitions (i.e. only $refs are allowed)
I have found the recommended solution in SwaggerHub documentation
But here is my question how to achieve:
split into domains(then using a reference), or
inline schemas
with Springfox
Or maybe there is another way to get rid of the above standardization error?
If you go to your home page, then hover over your organization on the left hand side and go to settings > Standardization, you should see some options. Unselect "API must not have local definitions (i.e. only $refs are allowed)" at the bottom.
And don't forget to save at the top right!

Get connection strings in ARM

I'm creating an Azure Resource Manager template that instantiates multiple resources.
I'd like to be able to capture the primary connection strings of
Redis , AzureWebJobsDashboard, AzureWebJobsStorage and AzureWebJobsServiceBus.
According to your description, I suggest you could use the ARM Template Function ListKeys to get the Keys. And we could use the following template code to set the connection string.
Here is a demo I capture the Redis, Storage, Service Bus connectionstring and add it to the web application settings.
Since AzureWebJobsDashboard, AzureWebJobsStorage is storage connection string, AzureWebJobsServiceBus is service Bus root manager connection string.
So in my template, I directly get the connection string according to the storage and service bus name.
1.Create Basic Azure Resource Group project with template WebApp
2.From demo remove the unnecessary resource.
3.Add the connection string setting
"resources": [
{
"name": "connectionstrings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('webSiteName'))]"
],
"tags": {
"displayName": "tomConnectionString"
},
"properties": {
"storage": {
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',concat(listKeys(variables('storageAccountId'),'2015-05-01-preview').key1))]",
"type": "Custom"
},
"Redis": {
"value": "[listKeys(resourceId('Microsoft.Cache/Redis', variables('RedisName')), '2016-04-01').primaryKey]",
"type": "Custom"
},
"ServiceBus": {
"value": "[listKeys(resourceId('Microsoft.ServiceBus/namespaces/AuthorizationRules',parameters('serviceBusNamespace'),'RootManageSharedAccessKey'),'2015-08-01').primaryConnectionString]",
"type": "Custom"
}
}
}
]
4.Add the corresponding parameters or variables such as storage info or service bus name.
5.Deploy the template
The result is as below:
Full template code:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"hostingPlanName": {
"type": "string",
"minLength": 1
},
"skuName": {
"type": "string",
"defaultValue": "S1",
"allowedValues": [
"F1",
"D1",
"B1",
"B2",
"B3",
"S1",
"S2",
"S3",
"P1",
"P2",
"P3",
"P4"
],
"metadata": {
"description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
}
},
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Storage Account to access blob storage."
}
},
"serviceBusNamespace": {
"type": "string",
"metadata": {
"description": "access service bus."
}
},
"skuCapacity": {
"type": "int",
"defaultValue": 1,
"minValue": 1,
"metadata": {
"description": "Describes plan's instance count"
}
}
},
"variables": {
"webSiteName": "[concat('webSite', uniqueString(resourceGroup().id))]",
"RedisName": "brando",
"storageAccountId": "[concat(resourceGroup().id,'/providers/Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "HostingPlan"
},
"sku": {
"name": "[parameters('skuName')]",
"capacity": "[parameters('skuCapacity')]"
},
"properties": {
"name": "[parameters('hostingPlanName')]"
}
},
{
"apiVersion": "2015-08-01",
"name": "[variables('webSiteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Website"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"properties": {
"name": "[variables('webSiteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"name": "connectionstrings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('webSiteName'))]"
],
"tags": {
"displayName": "tomConnectionString"
},
"properties": {
"storage": {
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',concat(listKeys(variables('storageAccountId'),'2015-05-01-preview').key1))]",
"type": "Custom"
},
"Redis": {
"value": "[listKeys(resourceId('Microsoft.Cache/Redis', variables('RedisName')), '2016-04-01').primaryKey]",
"type": "Custom"
},
"ServiceBus": {
"value": "[listKeys(resourceId('Microsoft.ServiceBus/namespaces/AuthorizationRules',parameters('serviceBusNamespace'),'RootManageSharedAccessKey'),'2015-08-01').primaryConnectionString]",
"type": "Custom"
}
}
}
]
}
]
}

ARM Template.json Dynamic connectionstring

I have taken a deployment template from azure and added this to a deployment project in Visual Studio 2015. When the Resource Group is made and deployed, everything works well except for the Web Site connectionstrings.
I have TableStorage, DocumentDb, and Redis instances all being created by this and cannot figure out how to get the Primary Connection String and Primary Key of these items so that I don't have to go in by hand and add them.
looking at the ARM Template Functions ListKeys should do the trick, but after deployment the value is empty. Furthermore, trying a simple string (TestConnectionString) also adds the name, but not the value.
{
"type": "Microsoft.Web/sites",
"kind": "app",
"name": "[parameters('WebAppName')]",
"apiVersion": "2015-08-01",
"properties": {
"name": "[parameters('WebAppName')]",
"resources": [],
"siteConfig": {
"connectionstrings": [
{
"name": "DocumentDbKey",
"value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('docDbName')), '2015-11-06').primaryMasterKey]",
"type": "Custom"
},
{
"name": "TestConnectionString",
"value": "dummystring:pleaseignore;",
"type": "Custom"
}
]
}
},
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('docDbName'))]",
]
}
As your description we can use ARM Template Functions ListKeys to get the Keys. And we could use the following template code to set the connection string. I test Azure storage connection string and Document DB key, It works correctly for me , please have a try. The following is my detail steps:
1.Create Basic Azure Resource Group project with template WebApp
2.From demo remove the unnecessary resource.
3.Add the connection string setting
"resources": [
{
"name": "connectionstrings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('webSiteName'))]"
],
"tags": {
"displayName": "tomConnectionString"
},
"properties": {
"documentDB": {
"value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', variables('docDbName')), '2015-11-06').primaryMasterKey]",
"type": "Custom"
},
"storage": {
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',concat(listKeys(variables('storageAccountId'),'2015-05-01-preview').key1))]",
"type": "Custom"
}
}
}
]
Add the corresponding parameters or variables such as storage info or docDbName
Deploy the Website
Check the result from the portal
Full template code:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"hostingPlanName": {
"type": "string",
"minLength": 1
},
"skuName": {
"type": "string",
"defaultValue": "S1",
"allowedValues": [
"F1",
"D1",
"B1",
"B2",
"B3",
"S1",
"S2",
"S3",
"P1",
"P2",
"P3",
"P4"
],
"metadata": {
"description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
}
},
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Storage Account to access blob storage."
}
},
"skuCapacity": {
"type": "int",
"defaultValue": 1,
"minValue": 1,
"metadata": {
"description": "Describes plan's instance count"
}
}
},
"variables": {
"webSiteName": "[concat('webSite', uniqueString(resourceGroup().id))]",
"docDbName": "tomdocumentdb",
"storageAccountId": "[concat(resourceGroup().id,'/providers/Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverfarms",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "HostingPlan"
},
"sku": {
"name": "[parameters('skuName')]",
"capacity": "[parameters('skuCapacity')]"
},
"properties": {
"name": "[parameters('hostingPlanName')]"
}
},
{
"apiVersion": "2015-08-01",
"name": "[variables('webSiteName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "Website"
},
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"properties": {
"name": "[variables('webSiteName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
},
"resources": [
{
"name": "connectionstrings",
"type": "config",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('webSiteName'))]"
],
"tags": {
"displayName": "tomConnectionString"
},
"properties": {
"documentDB": {
"value": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', variables('docDbName')), '2015-11-06').primaryMasterKey]",
"type": "Custom"
},
"storage": {
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',concat(listKeys(variables('storageAccountId'),'2015-05-01-preview').key1))]",
"type": "Custom"
}
}
}
]
}
]
}
Update:
We could get more useful info about ARM template from the azure resource.
I just had same problem, and it turns out the name of the property that holds the connection string should be named connectionString, so your siteConfig object should look like this:
"siteConfig": {
"connectionstrings": [
{
"name": "DocumentDbKey",
"connectionString": "[listKeys(resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('docDbName')), '2015-11-06').primaryMasterKey]",
"type": "Custom"
},
{
"name": "TestConnectionString",
"connectionString": "dummystring:pleaseignore;",
"type": "Custom"
}
]
}

PingFederate REST API for /sp/adapter not working

PingFederate 8.2.2 is used for our systems.All the REST APIs to create PF objects are automated but /sp/adapter(https://pfhost:9999/pf-admin-api/v1/sp/adapters) is not working using the below JSON .Manually If I create the same configuration it works.The below mentioned JSON is retrieved from already manually created /sp/adapter.But when I use the same JSON in API call which says error as below, please help to solve this problem.
ERROR:
{
"resultId": "validation_error",
"message": "Validation error(s) occurred. Please review the error(s) and address accordingly.",
"validationErrors": [
{
"message": "'' is not a valid selection for 'Send Extended Attributes'",
"fieldPath": "configuration.fields[21].value",
"errorId": "plugin_validation_error"
}
]
}
JSON:
{
"id": "opentokenadapt1",
"name": "opentokenadapt1",
"pluginDescriptorRef": {
"id": "com.pingidentity.adapters.opentoken.SpAuthnAdapter"
},
"configuration": {
"tables": [],
"fields": [
{
"name": "Password",
"value": "Password123"
},
{
"name": "Confirm Password",
"value": "Password123"
},
{
"name": "Transport Mode",
"value": "2"
},
{
"name": "Token Name",
"value": "opentoken"
},
{
"name": "Cipher Suite",
"value": "2"
},
{
"name": "Authentication Service",
"value": ""
},
{
"name": "Account Link Service",
"value": ""
},
{
"name": "Logout Service",
"value": ""
},
{
"name": "Cookie Domain",
"value": ""
},
{
"name": "Cookie Path",
"value": "/"
},
{
"name": "Token Lifetime",
"value": "300"
},
{
"name": "Session Lifetime",
"value": "43200"
},
{
"name": "Not Before Tolerance",
"value": "0"
},
{
"name": "Force SunJCE Provider",
"value": "false"
},
{
"name": "Use Verbose Error Messages",
"value": "false"
},
{
"name": "Obfuscate Password",
"value": "true"
},
{
"name": "Session Cookie",
"value": "false"
},
{
"name": "Secure Cookie",
"value": "false"
},
{
"name": "HTTP Only Flag",
"value": "true"
},
{
"name": "Send Subject as Query Parameter",
"value": ""
},
{
"name": "Subject Query Parameter ",
"value": ""
},
{
"name": "Send Extended Attributes",
"value": ""
},
{
"name": "Skip Trimming of Trailing Backslashes",
"value": "false"
}
]
},
"attributeContract": {
"coreAttributes": [
{
"name": "subject"
}
],
"extendedAttributes": [
{
"name": "nsroles"
}
]
}
}
"Send Extended Attributes" needs a valid value (not the empty string you've given it). The possible values are "0" (None), "1" (Cookies) or "2" (Query Parameters).
One tip in trying to narrow these issues down: try building the SP adapter instance in the PingFederate administrative console (UI) then compare it with the JSON model you GET from the API.

Resources