https://linen.dev logo
#help
Title
# help
d

Dragutin Todorović

10/20/2023, 8:40 AM
Hi 🙂 I have a question regarding recordState functionality. I’m putting in the state set of fields, for example:
Copy code
{
  "name": "recordState",
  "parameters": {
    "state": {
      "id": "{{jsonPath response.body '$.id'}}",
      "name": "{{jsonPath request.body '$.name'}}",
      "externalId": "{{jsonPath request.body '$.externalId'}}"
    },
    "context": "resource-{{jsonPath response.body '$.id'}}"
  }
}
If in the body any param is not passed, recordState will put in the context anyway this field with value empty string
""
. Afterward, when I want to GET this resource on GET endpoint, I’ll receive in the response empty string for value which is initially not passed (nullable field). Actually it should return null. Desired behaviour is to differentiate null from empty string. How to achieve desired behaviour of the mock?
Also, I tried with
default='null'
and it’s returning in the response
"null"
as string. But since this field should be numeric, I don’t want it to return in the response
"externalId": "null"
, I want it to be
"externalId": null
d

Dirk Bolte

10/20/2023, 11:43 AM
can you open a bug in https://github.com/wiremock/wiremock-extension-state ? Will take care of it
d

Dragutin Todorović

10/20/2023, 11:48 AM
Sure! I’ll also open one feature request, I found out something that’ll be nice to have as a functionality . 🙂
👍 1
2 Views