-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with bool variable setted by pre-request script #286
Comments
We have support for "{{$randomInt}}" which gets converted into number (not a string). |
@jdevosMagento What do you think about this proposal: Postman Variable: marco_polo (which is a Boolean or Number, not string) is used like {{marco_polo}} I ll still explore type detection based on OpenApi but this {{{}}} syntax allows the users to indicate a non-string type manually. Cc @nicklloyd, what is your opinion? |
Hello @thim81 yes sounds good to me! Otherwise why not add a "type" variable when you want to force the type :
In this case, if "type" is specified portman uses this value to define how it should return the data. But your proposal seems just as good |
Hi @jdevosMagento, I thought about the "type" setting option, but that would mean more configuration and complexity for the Portman users to learn and setup, while the goal is always to facilitate easy configuration of Portman but with enough flexibility. The {{{}}} provides the control by using an "escape" syntax, where you tell Portman to escape the "string" type and use it as a raw type. I'll turn this into a feature request and see when there is time to introduce the feature. |
It's perfect, thank you |
@jdevosMagento The PR is ready and will be reviewed. An example of the result of the conversion with the escaped number/boolean types. "overwrites": [
{
"openApiOperation": "*::/*",
"overwriteRequestBody": [
{
"key": "data[0].key_1",
"value": "{{attributeString}}",
"overwrite": true
},
{
"key": "data[0].key_2",
"value": "{{{attributeNumber}}}",
"overwrite": true
},
{
"key": "data[0].key_3",
"value": "{{{attributeBoolean}}}",
"overwrite": true
},
{
"key": "data[0].key_4",
"value": "Marco Polo {{attributeNumber}}",
"overwrite": true
},
{
"key": "data[1]",
"remove": true
}
]
}
] |
It's great the result is perfect, thank you for the efficiency! |
@jdevosMagento We just released version 1.15.0 of Portman, where this enhancement is included. |
Hello, i think there is a problem when using variationTests and overwriteRequestBody
i have this error :
No problem without variationTests, the boolean xxx its OK |
@jdevosMagento Are you able to share the OpenAPI specification (in a private way if required)? So we can try to reproduce the issue? |
Its Ok with this ?
|
@jdevosMagento We have found the cause and the PR with a fix will be part of the next release. |
Portman 1.15.1 has just been released with the fix for this behaviour included. |
I have a new problem.
This time, it is the use of a variable defined by a prerequest script and boolean type.
My API documentation:
My overwriteRequestBody:
I am forced to define value as a string, otherwise the json is invalid and portman shows json format error.
But by doing this, it integrates the attribute as a string also in postman and the call is therefore in failure because the API expects a boolean and not a string.
Postman:
The API normally expects: (without quotes)
I think it would be necessary, when generating the postman collection, to check if value is a variable and if so, cast according to a "type" attribute for example
The text was updated successfully, but these errors were encountered: