Skip to content
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

WIP: k6 API client generator #16336

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

PertsevRoman
Copy link

@PertsevRoman PertsevRoman commented Aug 16, 2023

k6 client generator

Hey,
I want to share this k6 client generator with the codegen community. The generator implements K6 client generation. It's not finished yet, I have to finalize some features like auth, internal unit tests, etc.

The reason why I created the generator - I want to integrate it to a bazel repo. K6 already integrated, so seems plans to have single-source-of-truth-apifirst build configuration goes well. :)

Will be very appreciate for a review!

@wing328
Copy link
Member

wing328 commented Aug 16, 2023

@PertsevRoman
Copy link
Author

@wing328 thanks for review!
k6 client you shared, tries to generate test cases. I'm not sure it useful for the most purposes. I suggest to generate API client library which uses k6 http implementation and leave a decision to a developer how to write tests.

@wing328
Copy link
Member

wing328 commented Aug 16, 2023

@PertsevRoman I see. Thanks for the explanation.

cc @mostafa

@mostafa
Copy link
Contributor

mostafa commented Aug 16, 2023

Hey @PertsevRoman and @wing328,

Thanks for your contribution! Let me clarify a few points:

  1. There is no such thing as K6s (or k6s). Unlike Kubernetes that is shortened to K8s, k6 is a shorthand for Kapablo, which is a load testing tool.
  2. Generating tests from an OpenAPI specification is natural to k6. Although you can do functional testing with k6 or create HTTP requests to smoke test your API, but it is meant for testing, hence the generation of test scripts using the original OpenAPI-k6 integration (that I wrote).

With all that said, your contribution seems like an interesting use case, which generates a set of models and ready-to-use functions to write tests. I'd be happy to see a mix of the two with an optional argument to either generate the test or generate the models and API calls only.

CC: @javaducky @nicolevanderhoeven

@wing328
Copy link
Member

wing328 commented Aug 17, 2023

Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors.

Let me know if you need help fixing it.

Ref: https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-can-i-update-commits-that-are-not-linked-to-my-github-account

@PertsevRoman
Copy link
Author

PertsevRoman commented Aug 17, 2023

My bad with email, it's not actual anymore. UPD: fixed

@PertsevRoman PertsevRoman force-pushed the add-k6s-client-generator branch 2 times, most recently from f0e7e77 to e2d41da Compare August 17, 2023 07:28
@PertsevRoman PertsevRoman force-pushed the add-k6s-client-generator branch from e2d41da to 8213d90 Compare August 17, 2023 07:31
@PertsevRoman
Copy link
Author

@mostafa thanks for review

  1. you're right, there is no such things like k6s, k6 only; this is a mix of k6 and k8s in my head - sometimes it happens when you memorizing smth. wrong and then it became very hard to use right name.
  2. I'll add the option; anyway, I'm not sure how can generated tests be useful due to generators knows nothing about target system scenarios; running a test which just iterating operations seems won't give a correct results

@PertsevRoman PertsevRoman marked this pull request as draft August 17, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants