Coder Social home page Coder Social logo

Comments (5)

exoego avatar exoego commented on June 10, 2024

Interesting. I did not know examples that can contain multiple examples https://swagger.io/docs/specification/adding-examples/

I am happy to accept pull request.

I prefer it defaults to single example and add a feature dlag for new behavior (examples)

from rspec-openapi.

lpender avatar lpender commented on June 10, 2024

Ok great. I'm in the middle of a project with a deadline and I haven't looked at the code yet.

So I'm not sure when I'll be able to get started but I will notify here if and when I do.

Please let me know if you have any recommendations on how you would architect / implement this.

Thanks again!

from rspec-openapi.

lpender avatar lpender commented on June 10, 2024

Hey--I'm realizing that this may be a killer bug for me... The issue effects not only outputs but inputs.

I need to test that the API gives a 200 for good input and 400 for bad input--a very common use case.

Unfortunately, the requestBody example will randomly generate the OAI schema using the bad input from time to time.

Let me know if there are any workarounds or if you think this might be a quick fix.

Thank you

from rspec-openapi.

exoego avatar exoego commented on June 10, 2024

Let me know if there are any workarounds or if you think this might be a quick fix.

Test cases can be excluded from OpenAPI generation with openapi: false argument.
So you can include only valid inputs.

RSpec.describe '/resources', type: :request do
  it 'returns a resource', openapi: false do
    # ...
  end
end

from rspec-openapi.

lpender avatar lpender commented on June 10, 2024

The thing is, I'd like to document 400 responses as well.

I think this will tide me over for now actually:

# Disable generating `example`
RSpec::OpenAPI.enable_example = false

Thanks !

from rspec-openapi.

Related Issues (20)

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.