eiffel-community / eiffel-remrem-generate

Apache License 2.0
8 stars 70 forks source link

No detailed fault information generated to the users #122

Closed emichaf closed 5 years ago

emichaf commented 5 years ago

Description

When generating events via remrem with incorrect JSON format, no detailed information is generated to the user about the root cause of the fault.

Proposed improvement: Generate detailed fault information to the users.

raja-maragani commented 5 years ago

REMReM Generate gives a response with 400 status : Request examples 1

{"msgParams": {"meta": {"type": "EiffelActivityFinishedEvent1", "tags": ["tag1","tag2"], "source": {"domainId": "example.domain", "host": "host", "name": "name", "uri": "http://java.sun.com/j2se/1.3/", "gav": {"groupId": "com.github.Ericsson", "artifactId": "eiffel-remrem-semantics", "version": "0.2.9"}}, "security": {"sdm": {"authorIdentity": "test", "encryptedDigest": "sample"}}}}, "eventParams": {"data": {"outcome": {"conclusion": "SUCCESSFUL"}, "persistentLogs": [{"name": "firstLog", "uri": "http://myHost.com/firstLog"}, {"name": "otherLog", "uri": "isbn:0-486-27557-4"}]}, "links": [{"type": "ACTIVITY_EXECUTION", "target": "aaaaaaaa-bbbb-5ccc-8ddd-eeeeeeeeeee1"}]}}

Response

{ "message": "EiffelActivityFinishedEvent", "cause": "Mismatch of eventype in request query parameter with property 'type' in the input json message" }

Request Example 2

{"msgParams": {"meta": {"type": "EiffelActivityFinishedEvent", "tags": ["tag1","tag2"], "source": {"domainId": "example.domain", "host": "host", "name": "name", "uri": "http://java.sun.com/j2se/1.3/", "gav": {"groupId": "com.github.Ericsson", "artifactId": "eiffel-remrem-semantics", "version": "0.2.9"}}, "security": {"sdm": {"authorIdentity": "test", "encryptedDigest": "sample"}}}}, "eventParams": {"data": {"outcome": {"conclusion": "SUCCESSFUL"}, "persistentLogs": [{"name": "firstLog", "uri": "http://myHost.com/firstLog"}, {"name": "otherLog", "uri": "isbn:0-486-27557-4"}]}, "links": []}}

Response

{ "message": "Cannot validate given JSON string", "cause": "com.ericsson.eiffel.remrem.semantics.validator.EiffelValidationException: Mandatory link type ACTIVITY_EXECUTION is missing" }

Request Example 3

{"msgParams": {"meta": {"type": "EiffelActivityFinishedEvent", "tags": ["tag1","tag2"], "source": {"domainId": "example.domain", "host": "host", "name": "name", "uri": "http://java.sun.com/j2se/1.3/", "gav": {"groupId": "com.github.Ericsson", "artifactId": "eiffel-remrem-semantics", "version": "0.2.9"}}, "security": {"sdm": {"authorIdentity": "test", "encryptedDigest": "sample"}}}}, "eventParams": {"data": {"outcome": {"conclusion": "SUCCESSFUL"}, "persistentLogs": [{"name": "firstLog", "uri": "http://myHost.com/firstLog"}, {"name": "otherLog", "uri": "isbn:0-486-27557-4"}]}, "links": [{"type": "xx", "target": "abc"}]}}

Response

{ "message": "Cannot validate given JSON string", "cause": "com.ericsson.eiffel.remrem.semantics.validator.EiffelValidationException: { \"instance\": { \"pointer\": \"/links/0/target\" }, \"domain\": \"validation\", \"keyword\": \"pattern\", \"message\": \"ECMA 262 regex \\"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$\\" does not match input string \\"abc\\"\", \"regex\": \"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$\", \"string\": \"abc\"}" }