portman: Bad request due to invalid request body generation

Hi,

we have just started with Portman, but we are facing an issue that looks like a bug but might also be a misconfiguration on our side.

image

  • Schema of the request body:

image

  • Generated request body from Portman:

image

  • Issue: The RoleAssignmentsModel is not there.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 29

Most upvoted comments

@FreyAtGit Thank you for the confirmation and your patience. Wishing you success as you build your use-cases with Portman!

@FreyAtGit

Update: The PR introduces convertV2 from openapi-to-postman, which is needed for respecting the content-type order for request body. In the PR I included the results after using Portman.

@FreyAtGit

Another short update: Portman is using convert (V1), while the openapi-to-postman introduced convertV2 (a while ago) made it the default for the CLI, but not for the direct usage as a openapi-to-postman module. We assumed that under the hood V2 had become the default, which had the recent improvement we did.

Long story short: we found the reason, switching to convertV2 would solve the cause BUT it looks that convertV2 has a a strange behaviour with ENUM values, which we want to sort out to prevent regression.

hi @FreyAtGit

I’m able to reproduce it. When I’m using a minimal version of your OpenAPI spec, it converts as expected: image

When using the full spec: image

Let me further investigate.

hi @FreyAtGit

FYI Portman v1.28.0 is just released, which will use the first-listed request body.

The PR openapi-to-postman was accepted and was released with v4.23.x of openapi-to-postman.

Thanks for your input. I had the same preference for Option A and will make that the default for Portman, which can always be overwritten via a config setting.

Ah no, you mean if there is a setting, then what would be the expected default behavior? Then, hmm…, both options seem a valid decision. But, you have an always clearly defined default with Option A (compared to Option B).

@FreyAtGit Another update: The Postman team already responded and indicated their preference to pick the content-type based on the order in the content-type list.

We will continue with that direction and hope that the PR will land soon in the openapi-to-postman package.

@FreyAtGit Short update:

We use the official openapi-to-postman package from Postman to convert openapi-to-postman. It is in that package, where the logic is fixed to take the ‘x-www-form-urlencoded’, before the ‘raw’ content-type.

We created an issue and PR + PR, with 2 options to have more control on the selection of the request body during the conversion.

Let’s see what the Postman team responds.

We own it and the goal is to use Portman for testing purposes, starting with contract-testing.

hi @FreyAtGit

Let me check, if re-ordering would help or if we can improve the logic to start with “application/json”. Another option would be to use any of the build-in filtering capabilities before conversion, to filter out the “requestBody.content”.

Give me a bit of time to do some experimenting, I’ll report back with my findings.

Question: The OpenAPI spec from Siemens is owned by you or your team or you are a consumer of it? And the goal is to use it for testing yourself or for distribution to integrators or internal teams?

FYI: If commenting out “x-www-form-urlencoded” the conversion behaves as more as expected:

image image

@FreyAtGit I’m able to reproduce the issue (see screenshot). image

First indication points towards the “x-www-form-urlencoded” conversion, but I will have to debug it more in detail to find the cause.

Postman only converts to 1 content-type during the conversion, Question: do you expect “x-www-form-urlencoded” in the Postman collection or “application/json”?

image

When we import it manually in Postman, it behaves similar by taking the “x-www-form-urlencoded”

image image