You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=== Type Safety with flexible JSON <- -> POJO marshalling/serialization and unmarshalling/deserialization
364
364
365
365
* ReṼoman internally uses a modern JSON library called https://github.com/square/moshi[**Moshi**]
366
-
* There may be a POJO that inherits or contains legacy classes which are hard or impossible to serialize. ReṼoman lets you serialize such a legacy POJO by letting you pass `skipTypes`, where you can filter-out these legacy class types.
367
-
* The payload may not map to POJO, and you may need a custom adapter for Conversion. Moshi has it covered for you with its advanced adapter mechanism and ReṼoman accepts Moshi adapters via `requestConfig`, `responseConfig` and `customAdapters`
366
+
* There may be a POJO that inherits or contains legacy types which are hard or impossible to serialize. ReṼoman lets you serialize such types through `globalSkipTypes`, where you can filter-out these legacy types from Marshalling/Unmarshalling, only focussing on fields that matter.
367
+
* The payload may not map to POJO, and you may need a custom types adapter for Marshalling/Unmarshalling. Moshi has it covered for you with its advanced adapter mechanism and ReṼoman accepts Moshi adapters via
368
+
** `requestConfig` — For types present as part of request payload for qualified Steps
369
+
** `responseConfig` — For types present as part of response payload for qualified Steps
370
+
** `globalCustomTypeAdapters` — For types present as part of request payload anywhere
368
371
* ReṼoman also comes bundled with link:{sourcedir}/com/salesforce/revoman/input/json/JsonReaderUtils.kt[JSON Reader utils] and link:{sourcedir}/com/salesforce/revoman/input/json/JsonWriterUtils.kt[JSON Writer utils] to help build Moshi adapters.
@@ -433,7 +436,7 @@ so the later steps can pick up value for `+{{xyzId}}+` variable from the environ
433
436
==== Response Validations
434
437
435
438
* Post-Hooks are the best place to validate response right after the step.
436
-
* If you have configured a strong type for your response through `responseConfig`, you can write type-safe validations by extracting your Strong type Object using `stepReport.responseInfo.get().<TypeT>getTypedTxnObj()` (if you have configured `responseConfig()` or `customAdapters()`) or use `JsonPojoUtils.jsonToPojo(TypeT, stepReport.responseInfo.get().httpMsg.bodyString())` to convert it inline.
439
+
* If you have configured a strong type for your response through `responseConfig`, you can write type-safe validations by extracting your Strong type Object using `stepReport.responseInfo.get().<TypeT>getTypedTxnObj()` (if you have configured `responseConfig()` or `globalCustomTypeAdapters()`) or use `JsonPojoUtils.jsonToPojo(TypeT, stepReport.responseInfo.get().httpMsg.bodyString())` to convert it inline.
437
440
* If your response data structure is non-trivial and have requirements to execute validations with different strategies like `fail-fast` or `error-accumulation`, consider using a library like https://github.com/salesforce-misc/Vador[*Vador*]
0 commit comments