OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.63k stars 6.53k forks source link

[REQ] Cypress API Generator #8008

Open vanakema opened 3 years ago

vanakema commented 3 years ago

Is your feature request related to a problem? Please describe.

We've found ourselves frustrated in having to write a manual API for doing state setup in our Cypress E2E tests.

Describe the solution you'd like

A Typescript Cypress generator that creates a library that uses cy.request for requests, and includes all the models as well, so we get type completion

Describe alternatives you've considered

We're currently using the ts-node generator and using cy.then to make requests in cypress through the ts-node generated library, but this doesn't use cypress's cy worker and logging, which makes debugging issues much harder, as you do not know what request failed, and command ordering is more unpredictable.

Additional context

All cy commands in cypress, go into a worker queue, for the Cypress runner to execute in FIFO order, rather than using the native async/await, which can obscure the execution order of commands if not using all cy commands, as well as obscures errors that occur.

I think all that really needs to happen is for the generator to make cy.request commands instead of node's built in request library

Intro to what Cypress is: https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Cypress-Can-Be-Simple-Sometimes

Explanation of Cypress's worker/runner: https://docs.cypress.io/guides/core-concepts/test-runner.html#Overview

wing328 commented 3 years ago

What about adding Cypress support to the typescript generator, which already supports the following?

    framework
        Specify the framework which should be used in the client code. (Default: fetch-api)
            fetch-api - fetch-api
            jquery - jquery
vanakema commented 3 years ago

That would be great. That solution would still require the cypress webpack plugin, but that’s totally acceptable compared to the logging issue.

On Nov 25, 2020, at 2:01 AM, William Cheng notifications@github.com wrote:

 What about adding Cypress support to the typescript generator, which already supports the following?

framework Specify the framework which should be used in the client code. (Default: fetch-api) fetch-api - fetch-api jquery - jquery — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Merynek commented 2 years ago

any news?

ericschaal commented 1 year ago

Would be awesome!

AlexandreCassagne commented 1 year ago

+1

bilarallen commented 1 year ago

+1

touchedthecode commented 1 year ago

+1

cvignal commented 1 year ago

+1

patricktucker005 commented 9 months ago

+1