About csv plugin <https://docs.pact.io/implementat...
# pact-plugins
t
About csv plugin https://docs.pact.io/implementation_guides/pact_plugins/plugins/csv#csv-matching-definitions: If we use headers, mock server will response with columns that are sorted by column's name in ascending order. For example:
Copy code
$response
            ->setStatus(200)
            ->setBody([
                'csvHeaders' => true,
                'column:id' => "matching(regex, '^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$','{$id}')",
                'column:name' => "matching(type,'{$name}')",
                'column:gender' => "matching(regex, 'male|female|other','{$gender}')",
            ])
            ->setContentType('text/csv')
        ;
Mock server will return:
Copy code
gender,id,name
$gender,$id,$name
Is this expected behavior?
u
You mean, was this planned behaviour? No, I don't think so, but it kind of makes sense.
t
It makes sense to me also. Currently I'm fine with it because the order of columns isn't important to me. But I think checking for the order of columns is important for some users. I'm thinking about this solution: Add
"csvColumns": "id,name,gender"
so: • Mock server will return columns in this order • Provider verifier will verify csv's columns in this order What do you think?
u
You are probably right
t
I will create a minor ticket for this improvement so we can discuss more about it in that ticket