Indexing of a `SCRoom` fails on `geoPoint`
Summary
Tried to index the Test Example of a SCRoom from Core and backend throws the following error:
{
"name": "ValidationError",
"message": "Validation of request failed",
"statusCode": 400,
"stack": "Error\n at new SCError (/app/node_modules/@openstapps/core/lib/index.js:105:27)\n at new SCValidationErrorResponse (/app/node_modules/@openstapps/core/lib/index.js:120:9)\n at Object.<anonymous> (/app/lib/routes/Route.js:69:35)\n at Generator.next (<anonymous>)\n at /app/lib/routes/Route.js:7:71\n at new Promise (<anonymous>)\n at __awaiter (/app/lib/routes/Route.js:3:12)\n at route.(anonymous function) (/app/lib/routes/Route.js:62:35)\n at handleReturn (/app/node_modules/express-promise-router/lib/express-promise-router.js:24:27)\n at /app/node_modules/express-promise-router/lib/express-promise-router.js:56:9",
"additionalData": [
{
"property": "instance",
"message": "is not any of <#/definitions/SCThingsWithoutDiff>,<#/definitions/SCDiff>",
"schema": {
"anyOf": [
{
"$ref": "#/definitions/SCThingsWithoutDiff"
},
{
"$ref": "#/definitions/SCDiff"
}
],
"description": "An object that exists in the StAppsCore"
},
"instance": {
"geo": {
"point": {
"type": "Point",
"coordinates": [
13.32615,
52.51345
]
}
},
"type": "room",
"categories": [
"cafe"
],
"uid": "540862f3-ea30-5b8f-8678-56b4dc217140",
"alternateNames": [
"MA Mathe Cafeteria"
],
"name": "Mathe Cafeteria",
"address": {
"addressCountry": "Germany",
"addressLocality": "Berlin",
"addressRegion": "Berlin",
"postalCode": "10623",
"streetAddress": "Straße des 17. Juni 136"
},
"origin": {
"indexed": "2018-09-11T12:30:00Z",
"name": "Dummy",
"type": "remote"
}
},
"name": "anyOf",
"argument": [
"<#/definitions/SCThingsWithoutDiff>",
"<#/definitions/SCDiff>"
],
"stack": "instance is not any of <#/definitions/SCThingsWithoutDiff>,<#/definitions/SCDiff>"
}
]
}
[Edit]
The error above where caused by the version 0.2.0 of the core, that is used by backend. That has no type field in origin. So i removed the field and got a new error message from backend:
{
"name": "InternalServerError",
"message": "Internal server error",
"statusCode": 502,
"stack": "Error\n at new SCError (/app/node_modules/@openstapps/core/lib/index.js:105:27)\n at new SCInternalServerErrorResponse (/app/node_modules/@openstapps/core/lib/index.js:188:9)\n at Object.<anonymous> (/app/lib/routes/Route.js:102:49)\n at Generator.throw (<anonymous>)\n at rejected (/app/lib/routes/Route.js:5:65)\n at process._tickCallback (internal/process/next_tick.js:68:7)",
"additionalData": {
"msg": "[parse_exception] geo_point expected",
"path": "/stapps_room_test_a532ba2a/room/540862f3-ea30-5b8f-8678-56b4dc217140/_create",
"query": {
"timeout": "90s"
},
"body": "{\"geo\":{\"point\":{\"type\":\"Point\",\"coordinates\":[13.32615,52.51345]}},\"type\":\"room\",\"categories\":[\"cafe\"],\"uid\":\"540862f3-ea30-5b8f-8678-56b4dc217140\",\"alternateNames\":[\"MA Mathe Cafeteria\"],\"name\":\"Mathe Cafeteria\",\"address\":{\"addressCountry\":\"Germany\",\"addressLocality\":\"Berlin\",\"addressRegion\":\"Berlin\",\"postalCode\":\"10623\",\"streetAddress\":\"Straße des 17. Juni 136\"},\"origin\":{\"indexed\":\"2018-09-11T12:30:00Z\",\"name\":\"Dummy\"},\"creation_date\":\"2019-01-30T12:30:12+00:00\"}",
"statusCode": 400,
"response": "{\"error\":{\"root_cause\":[{\"type\":\"parse_exception\",\"reason\":\"geo_point expected\"}],\"type\":\"mapper_parsing_exception\",\"reason\":\"failed to parse\",\"caused_by\":{\"type\":\"parse_exception\",\"reason\":\"geo_point expected\"}},\"status\":400}"
}
}
Steps to reproduce
Index the Thing SCRoom Example
Example Project
Send HTTP Request: http://localhost:3000/bulk/[BULK_UID] with Body of SCRoom Example
Which version of the software did you use ?
registry.gitlab.com/openstapps/backend/default:master
What is the current bug behavior?
Error shows up.
What is the expected correct behavior?
Example of SCRoom should be indexed in backend.
Relevant logs and/or screenshots
See Error above.
Possible fixes
Bug in geoPoint validation?
Edited by Sebastian Lange