Reusing Request Models/DTOs when there are optional fields

Hi,

I am wondering how elegantly reuse request body which is stored in a file?

So consider I have request stored like :

{
“username”: “Alex”
}

but what if I need to add to the same request additional fields. It’s basically the same Model, but with optional fields:

{
“username”: “Alex”,
“age”: “21”
}

So I dont want to create 2 separate files for it, want to reuse the same model

If you want to implement complex logic, you have to resort to a solution that’s more advanced than Gatling Expression Language.
For example, you could consider Pebble, see https://gatling.io/2018/11/gatling-3-pebble-templating/.