Convert OpenAPI3 examples to postman examples

Thanks for your reply.

In the example you provided (Photoroom API), they don’t use named examples, they just put a single example for every field and/or a default value.

image

Hence, the parameters, body and response values will be the same in all example requests when generating a collection.

What I want to do is generate example scenarios using named examples in OpenApi, in such a way that in a case like this

{
    "requestBody": {
        "content": {
            "application/json": {
                "schema": {
                    "type": "object",
                    "properties": {
                        "element_one": {
                            "type": "string",
                            "nullable": false
                        },
                        "element_two": {
                            "type": "number",
                            "nullable": false
                        }
                    }
                },
                "examples": {
                    "Success": { // Success Scenario
                        "value": {
                            "element_one": "yes",
                            "element_two": 20
                        }
                    },
                    "Incorrect": {  // Incorrect scenario
                        "value": {
                            "element_one": "yes"
                        }
                    }
                }
            }
        }
    }
}

It will generate two examples in collection for this path.

In the Success scenario, the request body should be

{
  "element_one": "yes",
  "element_two": 20
}

but in the Incorrect scenario, the request body should be

{
"element_one": "yes"
}

And applying the same logic for parameters and responses.