Coder Social home page Coder Social logo

plugin-openapi's Introduction

Screen Recording 2023-10-04 at 15 43 17

Note We just announced Support Plan for Step CI

Important For users migrating from Postman and Insomnia, see issues #29 and #30 respectively

Welcome

Step CI is an open-source API Quality Assurance framework

  • Language-agnostic. Configure easily using YAML, JSON or JavaScript
  • REST, GraphQL, gRPC, tRPC, SOAP. Test different API types in one workflow
  • Self-hosted. Test services on your network, locally and CI/CD
  • Integrated. Play nicely with others

Read the Docs

Try the Online Playground

Join us on Discord

Get started

  1. Install the CLI

    Using Node.js

    npm install -g stepci
    

    Note: Make sure you're using the LTS version of Node.js

    Using Homebrew

    brew install stepci
    
  2. Create example workflow

    workflow.yml

    version: "1.1"
    name: Status Check
    env:
      host: example.com
    tests:
      example:
        steps:
          - name: GET request
            http:
              url: https://${{env.host}}
              method: GET
              check:
                status: /^20/

    Note: You can also also use JSON format to configure your workflow

  3. Run the workflow

    stepci run workflow.yml
    
    PASS  example
    
    Tests: 0 failed, 1 passed, 1 total
    Steps: 0 failed, 1 passed, 1 total
    Time:  0.559s, estimated 1s
    
    Workflow passed after 0.559s
    

Documentation

Documentation is available on docs.stepci.com

Examples

You can find example workflows under examples/

Community

Join our community on Discord and GitHub

Contributing

As an open-source project, we welcome contributions from the community. If you are experiencing any bugs or want to add some improvements, please feel free to open an issue or pull request

Support Plan

Get Pro-level support with SLA, onboarding, prioritized feature-requests and bugfixes.

Learn more

Book us with Cal.com

Privacy

By default, the CLI collects anonymous usage data, which includes:

  • Unique user ID
  • OS Name
  • Node Version
  • CLI Version
  • Command (stepci init, stepci run, stepci generate)
  • Environment (Local, Docker, CI/CD)

Note The usage analytics can be disabled by setting STEPCI_DISABLE_ANALYTICS environment variable

License

The source code is distributed under Mozilla Public License terms

plugin-openapi's People

Contributors

century-ss avatar mishushakov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

plugin-openapi's Issues

Generate check object for all response codes (not 200 only)

Currently, when a response code is different than 200, the workflow generated will not contain check object, therefore the runner will not checking nor response code neither body.

I saw a specific condition for 200 in the code.

index.js line 167
if (swagger.paths[path][method].responses && swagger.paths[path][method].responses['200']) {

I wonder the reason of this and if there is something else I am missing.

We are interested on contribute, so we could develop to handle multiple response codes. Any suggestion is welcome, of course.

Check multiple response codes

This question could be related to #13

Having an OpenAPI document and the API implementation, we would like to check whether the API is in compliance with the contract.

In an OpenAPI document you can specify more than one response code with different body in each case. It would be nice we could test each one by making multiple requests for the same endpoint, one for each status code.

To obtain different response types from the API we could add an extra parameter that could be specified using OpenAPI extension x-something https://swagger.io/docs/specification/openapi-extensions/ that would result in a header that API will interpret to return the desired response.

What do you think about?

[Bug]: Reduce of empty array with no initial value

What happened?

Calling the main file works okay.

$ stepci run ./main.yml 
 PASS  blocks/487800d208d4cb43ef8d8a4ec162f479a76dbeee3b4c14295bd920d99d33e0c7

Tests: 0 failed, 1 passed, 1 total
Steps: 0 failed, 0 skipped, 1 passed, 1 total
Time:  0.149s, estimated 0s
CO2:   0.00024g

Workflow passed after 0.149s
Give us your feedback on https://step.ci/feedback

Calling a file that includes it does not:

$ cat workflow.yml
version: "1.1"
name: My tests
include:
 - main.yml
node_modules/@stepci/runner/dist/index.js:97
            co2: testResults.map(test => test.co2).reduce((a, b) => a + b)
                                                   ^

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at run (node_modules/@stepci/runner/dist/index.js:97:52)

What did you expect to happen?

To run my included workflow as does the main file.

Version

2.6.3

Environment

v16.16.0

How can we reproduce this bug?

See above.

Relevant log output

No response

Would you be interested in working on a bugfix for this issue?

  • Yes! Assign me

[Bug]: generate: Cannot read properties of undefined (reading 'forEach')

What happened?

stepci generate errors with

$ stepci generate ./openapi.yaml ./workflow.yml
stepci generate [spec] [path]

generate workflow from OpenAPI spec

Positionals:
  spec                    openapi file url    [string] [default: "openapi.json"]
  path                    output file path  [string] [default: "./workflow.yml"]
  generatePathParams                                   [boolean] [default: true]
  generateOptionalParams                               [boolean] [default: true]
  generateRequestBody                                  [boolean] [default: true]
  useExampleValues                                     [boolean] [default: true]
  useDefaultValues                                     [boolean] [default: true]
  checkStatus                                          [boolean] [default: true]
  checkExamples                                        [boolean] [default: true]
  checkSchema                                          [boolean] [default: true]
  contentType                             [string] [default: "application/json"]

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

TypeError: Cannot read properties of undefined (reading 'forEach')
    at generateWorkflow (blockfrost-stepci/node_modules/@stepci/plugin-openapi/index.js:186:42)
    at async generateWorkflowFile (node_modules/@stepci/plugin-openapi/index.js:197:45)
    at async Object.handler (node_modules/stepci/dist/index.js:137:5)

What did you expect to happen?

To get a nice workflow :)

Version

2.6.2

Environment

v16.16.0

How can we reproduce this bug?

Take this open api file and try it.

Relevant log output

TypeError: Cannot read properties of undefined (reading 'forEach')
    at generateWorkflow (/home/mmahut/repo/Blockfrost/blockfrost-stepci/node_modules/@stepci/plugin-openapi/index.js:186:42)
    at async generateWorkflowFile (/home/mmahut/repo/Blockfrost/blockfrost-stepci/node_modules/@stepci/plugin-openapi/index.js:197:45)
    at async Object.handler (/home/mmahut/repo/Blockfrost/blockfrost-stepci/node_modules/stepci/dist/index.js:137:5)

Would you be interested in working on a bugfix for this issue?

  • Yes! Assign me

[Bug]: Support 3.1 openapi

What happened?

3.1 doesnt seem to be supported https://share.perfstack.net/2023/07/chrome_2023-07-31_14-39-47.png

Cannot read properties of undefined (reading 'forEach')

Spec https://api.globalping.io/v1/spec.yaml

What did you expect to happen?

For the demo to work and guide to next steps

Version

Online

Environment

Online

How can we reproduce this bug?

No response

Relevant log output

No response

Would you be interested in working on a bugfix for this issue?

  • Yes! Assign me

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.