Skip to content

Commit

Permalink
test: error on bad json schema
Browse files Browse the repository at this point in the history
Signed-off-by: Mehdi Rebiai <[email protected]>
  • Loading branch information
mrebiai committed Aug 7, 2024
1 parent 54c9ad6 commit 315c21e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/test/resources/features/consumer-json-key-value.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ Feature: consumer-json-key-value
| topic_alias | key | value |
| topic_in | aTestKey_${uuid} | {"anInt": 1, "aString": "myString1", "anOptionalString": "test"} |
| topic_in | aTestKey_${uuid} | {"anInt": 2, "aString": "myString2", "anOptionalString": null } |
# the following payload does not respect json schema => the test must fail
# | topic_in | aTestKey_${uuid} | {"foo": "bar" } |
Then expected records
| topic_alias | key | value |
| topic_out | aTestKey_${uuid} | aliasValue1 |
| topic_out | aTestKey_${uuid} | aliasValue2 |
# | topic_out | aTestKey_${uuid} | aliasValue3 |
And assert aliasValue1 $.anInt == 1
And assert aliasValue1 $.aString == "myString1"
And assert aliasValue1 $.anOptionalString == "test"
And assert aliasValue2 $.anInt == 2
And assert aliasValue2 $.aString == "myString2"
And assert aliasValue2 $.anOptionalString == null
# And assert aliasValue3 $.foo == "bar"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"schemaType": "JSON","schema": "{ \"$schema\": \"http://json-schema.org/draft-04/schema#\", \"title\": \"com.lectra.kapoeira.jsonvaluev1\", \"description\": \"jsonvaluev1\", \"type\": \"object\", \"properties\": { \"anInt\": { \"type\": \"integer\" }, \"aString\": { \"type\": \"string\" }, \"anOptionalString\": {\"type\":[\"string\",\"null\"]} } }"}
{"schemaType": "JSON","schema": "{ \"$schema\": \"http://json-schema.org/draft-04/schema#\", \"title\": \"com.lectra.kapoeira.jsonvaluev1\", \"description\": \"jsonvaluev1\", \"type\": \"object\", \"properties\": { \"anInt\": { \"type\": \"integer\" }, \"aString\": { \"type\": \"string\" }, \"anOptionalString\": {\"type\":[\"string\",\"null\"]} }, \"required\": [\"aString\" ] }"}

0 comments on commit 315c21e

Please sign in to comment.