-
Notifications
You must be signed in to change notification settings - Fork 58
Bad request due to invalid request body generation #601
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
Comments
hi @FreyAtGit To verify, you have no special Portman configuration or conversion settings defined? |
@thim81 I have one to get the bearer token first and trying to setup some data on the "problem" endpoint. But no postman-config file. |
@FreyAtGit I'm able to reproduce the issue (see screenshot). 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, ![]() When we import it manually in Postman, it behaves similar by taking the "x-www-form-urlencoded" ![]() ![]() |
ah interesting, thanks. I will try it :) |
hi @FreyAtGit Let me check, if re-ordering would help or if we can improve the logic to start with "application/json". 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? |
We own it and the goal is to use Portman for testing purposes, starting with contract-testing. |
@FreyAtGit Short update: We use the official openapi-to-postman package from Postman to convert openapi-to-postman. 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. |
While we wait for feedback, you could try to filter out the but keep in mind that this will also remove the form from the "token" endpoint. If you don't need it for your contract testing, you could already progress. ![]() Have a look at "Diff" of your OpenAPI and the filtered OpenAPI result, in the playground |
@FreyAtGit Another update: We will continue with that direction and hope that the PR will land soon in the openapi-to-postman package. |
Thanks for your help :) |
@FreyAtGit Side-question to get some input from our community: what would you expect to be the default behavior, in case there are multiple content-types in the request body: Option A: Take the first content-type from the request body as ordered in the OpenAPI spec, meaning which ever is found first will be taken. |
I would go with Option A as it gives you the option to choose the one you want to use or even better, make a setting to define which one to choose (maybe a global setting would be enough) |
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). |
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. |
hi @FreyAtGit Another update the PR got accepted and merged by the Postman team. If it takes more time, we will include a patch in Portman. |
Sounds great, thank you very much :) |
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 a lot for the fast fix 👍😀 |
@thim81 I have just updated Portman and openapi2postman and tried it, but I still got the same (error) result :( |
@FreyAtGit Is "application/json" listed 1st in the request body content types of your OpenAPI spec? An alternative option is to pass along a postman config --postmanConfigFile, with Example
|
Ah, this is not per endpoint, this is per whole spec? Edit: also the setting is not working for me |
@FreyAtGit Let me run some manual validation, since we have tests in place to verify the results. |
hi @FreyAtGit I'm able to reproduce it. Let me further investigate. |
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. Long story short: we found the reason, switching to |
Update: The PR introduces |
hi @FreyAtGit We implemented |
@thim81 It is working now 😀. Thank you very much! |
@FreyAtGit Thank you for the confirmation and your patience. |
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.
API: https://developer.siemens.com/tcpcm/tcpcm-api-spec.yaml
Endpoint: PUT::/api/v1/administration/samAuth/users/{username}
RoleAssignmentsModel
is not there.The text was updated successfully, but these errors were encountered: