Skip to content

[BUG] Only generate 2 operations swagger to k6 #19110

@DevMrRober

Description

@DevMrRober

Hello, good afternoon @mostafa

I have detected that in the version change from 5.3.0 to 5.3.1 there is a bug that is dragging to the latest current version v7.7.0.

The bug itself is to generate more than 2 methods per path, ie if I have a path "/users" with a "GET, POST, PUT, PATCH" I will only generate 2 of the methods leaving the others.

I pass code

V5.3.0

group("/users/{userId}", () => {
let locale = 'TODO_EDIT_THE_LOCALE'; // specify value as there is no example value for this parameter in OpenAPI spec
let userId = 'TODO_EDIT_THE_USERID'; // specify value as there is no example value for this parameter in OpenAPI spec
let url = BASE_URL + /users/${userId}?locale=${locale};
// Request No. 1
let request = http.get(url);
check(request, {
"User found. Resource obtained successfully.": (r) => r.status === 200
});
sleep(SLEEP_DURATION);

// Request No. 2
// TODO: edit the parameters of the request body.
body = {"user": {"ids": "useridmodel", "firstName": "string", "lastName": "string", "email": "string", "dateOfBirth": "date", "isEmailVerified": "boolean", "creationDate": "date"}};
params = {headers: {"Content-Type": "application/json"}};
request = http.put(url, body, params);
check(request, {
    "User full information updated.": (r) => r.status === 200
});
sleep(SLEEP_DURATION);

// Request No. 3
request = http.del(url);
check(request, {
    "Resource deleted successfully.": (r) => r.status === 204
});
sleep(SLEEP_DURATION);

// Request No. 4
// TODO: edit the parameters of the request body.
body = {"user": {"ids": "useridmodel", "firstName": "string", "lastName": "string", "email": "string", "dateOfBirth": "date", "isEmailVerified": "boolean", "creationDate": "date"}};
params = {headers: {"Content-Type": "application/json"}};
request = http.patch(url, body, params);
check(request, {
    "User partial information updated successfully.": (r) => r.status === 200
});
sleep(SLEEP_DURATION);

});

V5.3.1
group("/users/{userId}", () => {
let locale = 'TODO_EDIT_THE_LOCALE'; // specify value as there is no example value for this parameter in OpenAPI spec
let userId = 'TODO_EDIT_THE_USERID'; // specify value as there is no example value for this parameter in OpenAPI spec

// Request No. 1
{
    let url = BASE_URL + `/users/${userId}?locale=${locale}`;
    let request = http.get(url);

    check(request, {
        "User found. Resource obtained successfully.": (r) => r.status === 200
    });

    sleep(SLEEP_DURATION);
}

// Request No. 2
{
    let url = BASE_URL + `/users/${userId}?locale=${locale}`;
    // TODO: edit the parameters of the request body.
    let body = {"user": {"ids": "useridmodel", "firstName": "string", "lastName": "string", "email": "string", "dateOfBirth": "date", "isEmailVerified": "boolean", "creationDate": "date"}};
    let params = {headers: {"Content-Type": "application/json", "Accept": "application/json"}};
    let request = http.patch(url, JSON.stringify(body), params);

    check(request, {
        "User partial information updated successfully.": (r) => r.status === 200
    });
}

});

im using this commands:

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.3.0 generate -i /local/users.swagger.v2.0.0.json -g k6 -o /local/k6-test/ --skip-validate-spec

docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.3.1 generate -i /local/users.swagger.v2.0.0.json -

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions