Generating JS bodies in k6 script from requestBody Open API specs

So I saw the PR back in Dec 21’ where now with the k6 generator requestBody examples can be extracted and placed into a k6 load testing file (I believe it was #1106). I have the path/query examples being replaced from the spec file but for the life of me I can’t figure out why the example(s) in my requestBody aren’t being added when I’m generating the test file.

I am using a container with the latest openapi-generator-cli. I’m using the Swagger Petstore example and this is the post on the “/pets” endpoint. Probably just something simple I’m missing but I couldn’t find any examples of JSON open api spec files in the repository or on swagger. Load-testing file is generating fine except for this.

"post": {
                    "description": "Creates a new pet in the store. Duplicates are allowed",
                    "operationId": "addPet",
                    "requestBody": {
                        "description": "Pet to add to the store",
                        "required": true,
                        "example": {"name": "Spot", "tag": "available"},
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/NewPet"
                                }
                            }
                        }
                    },
                    "responses": {
                        "200": {
                            "description": "pet response",
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Pet"
                                    }
                                }
                            }
                        },
                        "default": {
                            "description": "unexpected error",
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Error"
                                    }
                                }
                            }
                        }
                    }
                }
            }

Thanks in advance

Hi @justinmonty222, welcome to the community forum!

Can you expand on what isn’t working and what you tried.

Also, maybe that should be asked in the openapi-generator-cli issues? As if it can’t generate something, it is likely a problem with it.

Okay sure, I will ask there instead sorry about that.