"This property must be an Array, not an array" Error from AWS Healthlake - amazon-web-services

I'm converting Apple records data (in DSTU2 format) to R4 format.
This is the data I'm sending to healthlake server
{
"category": [
{
"text": "Vital Signs",
"coding": [
{
"system": "http://hl7.org/fhir/observation-category",
"code": "vital-signs"
}
]
}
],
"issued": "2017-03-18T00:00:00Z",
"status": "final",
"id": "49a1b0f9-34c2-472d-8b64-34447d307c56",
"code": {
"text": "Temperature",
"coding": [{ "system": "http://loinc.org", "code": "8310-5" }]
},
"encounter": { "reference": "Encounter/355" },
"subject": { "reference": "Patient/82146c45-a7cd-47ee-a5ba-8c588d4c5c9e" },
"valueQuantity": {
"code": "Cel",
"system": "http://unitsofmeasure.org",
"value": 37.6,
"unit": "Cel"
},
"resourceType": "Observation",
"meta": { "lastUpdated": "2023-01-30T09:17:54.772Z" }
}
But the healthlake server is giving me the following error
{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"This property must be an Array, not an array","location":["Observation.category[0]"]}]}
What does this error means and how to fix this?
PS: I'd only googled the error and could not get any leads

Related

I got this error (#132000) Number of parameters does not match the expected number of params

enter image description here
Here this is my custom template which I have created. Using this template am
trying to send what's app msg but i got 132000 error
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "917760569250",
"type": "template",
"template": {
"name": "media_messages",
"language": {
"code": "en_US"
},
"components": [
{
"type":"header",
"parameters":[
{
"type":"document",
"document":{
"id": "1195808994372455"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Document"
}
]
}
]
}
}

Data does not match any schemas from 'oneOf'

I am getting this error after upgrading my api from .netcore2.2 to 3.1 and trying to generate using autorest with the --v3 switch
WARNING: Schema violation: Data does not match any schemas from
'oneOf'
I have tried with and without SerializeAsV2
I see from the Autorest docs that this warning is because of an supported feature.
anyOf, oneOf are not currently supported
In services.AddSwaggerGen I have
c.ParameterFilter<SwaggerEnumParameterFilter>();
c.SchemaFilter<SwaggerEnumFilter>();
where
public void Apply(OpenApiParameter parameter, ParameterFilterContext context)
{
var type = context.ApiParameterDescription.Type;
if (type.IsEnum)
parameter.Extensions.Add("x-ms-enum", new OpenApiObject
{
["name"] = new OpenApiString(type.Name),
["modelAsString"] = new OpenApiBoolean(false)
});
}
public class SwaggerEnumFilter : ISchemaFilter
{
public void Apply(OpenApiSchema model, SchemaFilterContext context)
{
if (model == null)
throw new ArgumentNullException("model");
if (context == null)
throw new ArgumentNullException("context");
if (context.Type.IsEnum)
model.Extensions.Add(
"x-ms-enum",
new OpenApiObject
{
["name"] = new OpenApiString(context.Type.Name),
["modelAsString"] = new OpenApiBoolean(false)
}
);
}
}
[update]
After upgrading to Autorest 3.0.6244 the warnings have changed to errors and the error message ends with
post > parameters > 0)
If I don't use the v3 switch I get the error
FATAL: swagger-document/individual/schema-validator - FAILED
FATAL: Error: [OperationAbortedException] Error occurred. Exiting.
Process() cancelled due to exception : [OperationAbortedException] Error occurred. Exiting.
I can see in the swagger.json that the parameters property "name" is not generating correctly. Here it contains "body" whereas previously it contained "info"
"/api/FrameLookUp": {
"post": {
"tags": [
"Frame"
],
"operationId": "FrameLookup",
"consumes": [
"application/json-patch+json",
"application/json",
"text/json",
"application/*+json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "header",
"name": "Authorization",
"description": "access token",
"required": true,
"type": "String"
},
{
"in": "body",
"name": "body",
"schema": {
"$ref": "#/definitions/FrameRequest"
}
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/FrameResponse"
}
}
}
}
},
The controller is
[Produces("application/json")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
[Route("api")]
public class FrameController : MyController
{
[ProducesResponseType(typeof(FrameResponse), StatusCodes.Status200OK)]
[HttpPost("FrameLookUp")]
public IActionResult FrameLookup([FromBody] FrameRequest info)
{
IMyResponse MyFunc(IMyRequest x) => FrameData.FrameLookUp(info);
return InnerMethod(MyFunc, info);
}
}
Update
I have also tried using the SwaggerParameter from Swashbuckle.AspNetCore.Annotations
[Update]
I am thinking that maybe I just need to try the release for issue 1766
I tried cloning the swashbuckle.aspnetcore repo but ran into this issue
[Update]
I added c.GeneratePolymorphicSchemas(); to the AddSwaggerGen options but it has not helped.
[Update]
Here is the first error message
ERROR: Schema violation: Data does not match any schemas from 'oneOf'
- https://localhost:44348/api-docs/v1/swagger.json:1951:8 ($.paths["/api/synchronise-management/get-product-images-Ids"].post.parameters)
Investigating line 1951 in swagger.json
In the working swagger ( generated from dotnet2.2 project ) the json looks very similar however the parameter order is swapped
The other difference I can see is the generated name of the parameter
I see from this question the error occurs in the same place
[Update]
when I add the --debug switch to the autorest call I get
/configuration
DEBUG: pipeline-emitter - END
DEBUG: configuration-emitter - END
DEBUG: swagger-document-override/md-override-loader - END
DEBUG: swagger-document/loader - END
DEBUG: swagger-document/individual/transform - START
DEBUG: swagger-document/individual/transform - END
DEBUG: swagger-document/individual/schema-validator - START
ERROR: Schema violation: Data does not match any schemas from 'oneOf'
- https://localhost:44348/api/v1/swagger.json:1951:8 ($.paths["/api/synchronise-management/get-product-images-Ids"].
[Update]
Here is the cut down json
{
"swagger": "2.0",
"info": {
"title": "myapi API31",
"description": "ASP.NET Core Web API",
"version": "v1"
},
"host": "localhost:44348",
"basePath": "/v1",
"schemes": [
"https"
],
"paths": {
"/api/Test": {
"get": {
"tags": [
"Auth"
],
"operationId": "Test",
"responses": {
"200": {
"description": "Success"
}
}
}
},
"/api/RequestToken": {
"post": {
"tags": [
"Auth"
],
"operationId": "RequestToken",
"consumes": [
"application/json-patch+json",
"application/json",
"text/json",
"application/*+json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "body",
"name": "body",
"schema": {
"$ref": "#/definitions/TokenRequest"
}
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/TokenResponse"
}
}
}
}
},
"/api/FrameLookUp": {
"post": {
"tags": [
"Frame"
],
"operationId": "FrameLookup",
"consumes": [
"application/json-patch+json",
"application/json",
"text/json",
"application/*+json"
],
"produces": [
"application/json"
],
"parameters": [
{
"in": "header",
"name": "Authorization",
"description": "access token",
"required": true,
"type": "String"
},
{
"in": "body",
"name": "body",
"schema": {
"$ref": "#/definitions/FrameRequest"
}
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"$ref": "#/definitions/FrameResponse"
}
}
}
}
}
},
"definitions": {
"TokenRequest": {
"required": [
"password",
"username"
],
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"TokenResponse": {
"type": "object",
"properties": {
"tokenResult": {
"type": "string"
}
}
},
"FramePackTypeEnum": {
"enum": [
"NotApplicable",
"PipeRack",
"LwBVan",
"VanTray",
"Car",
"CarryBag"
],
"type": "string",
"x-ms-enum": {
"name": "FramePackTypeEnum",
"modelAsString": false
}
},
"FrameRequest": {
"type": "object",
"properties": {
"qCodeJobId": {
"format": "int32",
"type": "integer"
},
"quantity": {
"format": "int32",
"type": "integer"
},
"widthInMm": {
"format": "int32",
"type": "integer"
},
"heightInMm": {
"format": "int32",
"type": "integer"
},
"ePackingType": {
"$ref": "#/definitions/FramePackTypeEnum"
},
"userEmail": {
"type": "string"
}
}
},
"FrameCaseEnum": {
"enum": [
"Case0_NoBraces",
"Case1_1Vertical_0Horizontal",
"Case2_2Vertical_0Horizontal",
"Case3_NVertical_0Horizontal",
"Case4_0Vertical_1Horizontal",
"Case5_1Vertical_1Horizontal",
"Case6_2Vertical_1Horizontal",
"Case7_NVertical_1Horizontal",
"Case8_0Vertical_2Horizontal",
"Case9_1Vertical_2Horizontal",
"Case10_2Vertical_2Horizontal",
"Case11_NVertical_2Horizontal",
"Case12_0Vertical_NHorizontal",
"Case13_1Vertical_NHorizontal",
"Case14_2Vertical_NHorizontal",
"Case15_NVertical_NHorizontal"
],
"type": "string",
"x-ms-enum": {
"name": "FrameCaseEnum",
"modelAsString": false
}
},
"FrameResponse": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"caseNumber": {
"$ref": "#/definitions/FrameCaseEnum"
},
"memberPriceEachExGst": {
"format": "double",
"type": "number"
},
"retailPriceEachExGst": {
"format": "double",
"type": "number"
}
}
}
}
}
With the .netcore2.2 api the request generates as
"FrameRequest": {
"type": "object",
"properties": {
"qCodeJobId": {
"format": "int32",
"type": "integer"
},
"quantity": {
"format": "int32",
"type": "integer"
},
"widthInMm": {
"format": "int32",
"type": "integer"
},
"heightInMm": {
"format": "int32",
"type": "integer"
},
"ePackingType": {
"enum": [
"NotApplicable",
"PipeRack",
"LwBVan",
"VanTray",
"Car",
"CarryBag"
],
"type": "string",
"x-ms-enum": {
"name": "FramePackTypeEnum",
"modelAsString": false
}
},
"userEmail": {
"type": "string"
}
}
}
Here is the command line I am running
autorest --input-file=.\myswagger.json --output-folder=generated --csharp --namespace=DDD --debug
Some links which the author, Kirsten Greed, put in comments:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore#schema-filters
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/pull/1766
https://stackoverflow.com/questions/63857310/could-not-find-a-part-of-the-path-d-dev-swashbuckle-aspnetcore-src-swashbuckle
From your swagger.json we can see the validation shows:
https://validator.swagger.io/validator/debug?url=https://raw.githubusercontent.com/heldersepu/hs-scripts/master/swagger/63783800_swagger.json
{
"schemaValidationMessages": [
{
"level": "error",
"domain": "validation",
"keyword": "oneOf",
"message": "instance failed to match exactly one schema (matched 0 out of 2)",
"schema": {
"loadingURI": "http://swagger.io/v2/schema.json#",
"pointer": "/definitions/parametersList/items"
},
"instance": {
"pointer": "/paths/~1api~1FrameLookUp/post/parameters/0"
}
}
]
}
that lead us to your code:
that type: "String" should be: type: "string" with all lower case the error goes away

AWS API Gateway fails to import Swagger definition: Unsupported model type 'MapProperty'

I am currently on this screen trying to import my app's swagger definition so I can create an API Gateway instance.
Unfortunately, you can see I'm getting some errors - even though swagger seems to think it's entirely fine.
Your API was not imported due to errors in the Swagger file.
Unable to create model for 200 response to method 'GET /api/v1/courses': Validation Result: warnings : [], errors : [Invalid content type specified: */*]
Unsupported model type 'MapProperty' in 200 response to method 'GET /api/v1/courses/all'. Ignoring.
Here is my swagger definition:
{
"swagger": "2.0",
"info": {
"description": "Api Documentation",
"version": "1.0",
"title": "Api Documentation",
"termsOfService": "urn:tos",
"contact": {},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
},
"host": "********.appspot.com",
"basePath": "/",
"tags": [{
"name": "course-controller",
"description": "Course Controller"
}],
"paths": {
"/api/v1/courses": {
"get": {
"tags": ["course-controller"],
"summary": "getCourses",
"operationId": "getCoursesUsingGET",
"produces": ["*/*"],
"parameters": [{
"name": "code",
"in": "query",
"description": "code",
"required": false,
"type": "string"
}],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Course"
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"deprecated": false
}
},
"/api/v1/courses/all": {
"get": {
"tags": ["course-controller"],
"summary": "getAllCourses",
"operationId": "getAllCoursesUsingGET",
"produces": ["*/*"],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "object"
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"deprecated": false
}
}
},
"definitions": {
"Course": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"credits": {
"type": "integer",
"format": "int32"
},
"id": {
"type": "integer",
"format": "int32"
},
"lastUpdated": {
"type": "string"
},
"name": {
"type": "string"
},
"prerequisites": {
"type": "string"
},
"restrictions": {
"type": "string"
},
"seats": {
"$ref": "#/definitions/Seats"
},
"waitlist": {
"$ref": "#/definitions/Seats"
}
},
"title": "Course"
},
"Seats": {
"type": "object",
"properties": {
"actual": {
"type": "integer",
"format": "int32"
},
"capacity": {
"type": "integer",
"format": "int32"
},
"remaining": {
"type": "integer",
"format": "int32"
}
},
"title": "Seats"
}
}
}
Is there any reason you can find for this swagger definition breaking in API Gateway?
AWS API Gateway has some limitations in its OpenAPI support. For example, it does not support additionalProperties in models (this keyword is used in the 200 response schema for the /api/v1/courses/all endpoint in your API).
You can click the "Import and ignore warnings" button to ignore those errors and proceed with the import.

Graph API Batch Request. Error (#803)

I need to get friends' albums with photos. Do that with batch query (coz https://developers.facebook.com/docs/reference/fql/).
[
{ "method":"GET",
"name":"get-friends",
"relative_url":"me/friends?fields=id,name",
"omit_response_on_success": false
},
{
"method":"GET",
"name":"get-albums",
"relative_url":"{result=get-friends:$.data.*.id}/albums",
"omit_response_on_success": false
},
{
"method":"GET",
"name":"get-photos",
"relative_url":"{result=get-albums:$.data.*.id}/photos"
}
]
But in response i got error.This is response:
[
{
"code": 200,
"body": "{
"data": [
{
"id": "xxxx",
"name": "Name Lastname"
},{
"id": "xxxx",
"name": "Name2 Lastname"
}
],
"paging": {
"next": "https://graph.facebook.com/v2.4/xxx/friends?fields=id,name&format=json&access_token=xxx&limit=25&offset=25&__after_id=enc_xxx"
},
"summary": {
"total_count": 4
}
}"
},
{
"code": 200,
"body": "{
"data": [
{
"name": "1 Photos",
"created_time": "2012-11-22T04:22:46+0000",
"id": "xxx"
},
{
"name": "2 Pictures",
"created_time": "2010-09-12T02:48:42+0000",
"id": "xxx"
},
{
"name": "3 Personal",
"created_time": "2007-10-25T15:59:06+0000",
"id": "xxx"
}
],
"paging": {
"cursors": {
"after": "NTc0NyQxMzkwOQ==",
"before": "MTAxNTuyNjIzMzQwMDg5MTA="
}
}
}"
},
{
"code": 404,
"body": "{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: xxx,xxx,xxx",
"type": "OAuthException",
"code": 803
}
}"
}
]
Please tell me where is my mistake or tell me another way.
You canĀ“t get access to albums of friends, all friend permissions have been removed with v2.0 of the Graph API: https://developers.facebook.com/docs/apps/changelog#v2_0
You can only get access to albums of users who authorized your App (with user_photos, of course).

Facebook Graph Api: Unable to get latest post for keywords

Can anyone help me, When I request using link
https://graph.facebook.com/search?&limit=2&until=now&q=hi&type=post&access_token=AAAAAAITEghMBAIScEzst3h5VpV8pKZA7di2ZC3czxr5
Note: I am not giving valid token for security reason.
I always get the result for 27 Nov 2012, while I tried to search for latest post. Am I missing something? Please help.
Thanks in Advance.
RESULT I get:
{
"data": [
{
"id": "730221920_10151138508071921",
"from": {
"name": "Pinky Saowichit",
"id": "730221920"
},
"message": "\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c\u0e19\u0e35\u0e49\u0e2d\u0e32\u0e08\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e2d\u0e2d\u0e31\u0e19\u0e1a\u0e48\u0e2d\u0e22\u0e46 \u0e19\u0e30\u0e04\u0e30 \u0e41\u0e1f\u0e19\u0e04\u0e25\u0e31\u0e1a \u0e43\u0e2b\u0e49\u0e23\u0e39\u0e49\u0e27\u0e48\u0e48\u0e32\u0e04\u0e34\u0e14\u0e16\u0e36\u0e07\u0e19\u0e30\u0e04\u0e30 \u0e41\u0e15\u0e48\u0e15\u0e2d\u0e19\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e01\u0e33\u0e25\u0e31\u0e07\u0e04\u0e34\u0e14\u0e16\u0e36\u0e07\u0e04\u0e38\u0e13 \u0e04\u0e32\u0e19\u0e18\u0e35\u0e41\u0e25\u0e30\u0e40\u0e17\u0e40\u0e23\u0e0b\u0e48\u0e32\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e21\u0e32\u0e01\u0e46 \u0e2b\u0e38 \u0e2b\u0e38",
"privacy": {
"value": ""
},
"type": "status",
"status_type": "mobile_status_update",
"created_time": "2012-11-27T03:12:32+0000",
"updated_time": "2012-11-27T07:44:54+0000",
"likes": {
"data": [
{
"name": "Weniefredo Laud",
"id": "100004751890183"
},
{
"name": "\u0e1e\u0e23\u0e15 \u0e1c\u0e25\u0e14\u0e35",
"id": "100001056963372"
},
{
"name": "\u0e08\u0e23\u0e34\u0e0d\u0e32 \u0e25\u0e2d\u0e27",
"id": "100000046347271"
},
{
"name": "Noolek Tikamborn",
"id": "100003048464258"
}
],
"count": 6
}
},
{
"id": "100003971930240_283727615063091",
"from": {
"name": "Mariana Salcedo",
"id": "100003971930240"
},
"story": "Mariana Salcedo shared a link.",
"picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQASxQms6c0xFkdO&w=90&h=90&url=http\u00253A\u00252F\u00252Fask.fm\u00252Fimages\u00252F50x50.gif",
"link": "http://ask.fm/marianasalcedo/answer/15735435637",
"name": "CRUSH hi",
"caption": "jajajajaja que enfadosa erees!",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v2/yN/x/aS8ecmYRys0.gif",
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"application": {
"name": "Ask.fm",
"id": "129215213762342"
},
"created_time": "2012-11-27T03:11:38+0000",
"updated_time": "2012-11-27T03:11:38+0000"
}
],
"paging": {
"previous": "https://graph.facebook.com/search?q=hi&limit=2&type=post&access_token=AAAAAAITEghMBAIScEzst3h5VpV8pKZA7di2ZC3czxr5ANnvKPPc1wqYJJZAANd9PI0NKLX5Xk5ReRX3T01iim8BoJp6r16itU8vPxRP&since=1353985952&__previous=1",
"next": "https://graph.facebook.com/search?q=hi&limit=2&type=post&access_token=AAAAAAITEghMBAIScEzst3h5VpV8pKZA7di2ZC3czxr5ANnvKPPc1wqYJJZAANd9PI0NKLX5Xk5ReRX3T01iim8Bo&until=1353985897"
}
}