Replies: 3 comments 8 replies
-
I have a small follow-up question here. When setting casing to snake_case, the generated collection is still setting authorization to use the variable {{bearerToken}}. However, when this is set in .env-portman via Is there a preferred way to override this behavior? |
Beta Was this translation helpful? Give feedback.
-
Attached are a spec and a config that demonstrate the issue when The spec includes The config includes the following rules # Set a general rule to assign a postman id variable from the response bodies
# of any POST or GET requests
assignVariables:
- openApiOperation: POST::*
collectionVariables:
- responseBodyProp: id
name: <tag>Id
- openApiOperation: GET::*
excludeForOperations:
- "GET::/*/{id}"
collectionVariables:
- responseBodyProp: <tag>[0].id
name: <tag>Id
# Set a general rule to assign the ID path variable to the ID that was
# seen in a previous GET or POST request
overwrites:
- openApiOperation: "*::/*/{id}"
overwriteRequestPathVariables:
- key: id
value: '{{<tag>Id}}'
overwrite: true Here is (part of) the generated post request script for the Get All request: // pm.collectionVariables - Set plaidAccountsId as variable for jsonData.plaidAccounts[0].id
if (_resPlaidAccounts0Id !== undefined) {
pm.collectionVariables.set("plaidAccountsId", jsonData.plaidAccounts[0].id);
console.log("- use {{plaidAccountsId}} as collection variable for value",jsonData.plaidAccounts[0].id);
} else {
console.log('INFO - Unable to assign variable {{plaidAccountsId}}, as jsonData.plaidAccounts[0].id is undefined.');
}; From this we can see that Portman has applied the "camelCase" rule to the |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I've been working with the
variableCasing
property in my config set to camelCase.Recently I started writing some endpoints that use a snake case tag, ie "plaid_accounts" that return response bodies with a
plaid_accounts
property. I also have the following in my portman-config:What I found, however, was that it was interpreting the value of in this case to "plaidAccounts" and failing.
I figured this was what I asked for when I set
variableCasing
tocamelCase
, so I've changed that tosnakeCase
and have been working through my scripts to modify all references to Portman variables to use snake casing.The curious thing is that the variable
currentTag
is still being set in camelCase. I know that this was recently added to my request (thank you!), but it looks like some extra logic is needed to use the right casing.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions