Coder Social home page Coder Social logo

Comments (7)

k0kubun avatar k0kubun commented on June 10, 2024 1

Thank you for reporting this. Since you already have a small reproduction code, could you also turn the issue directory into a working test case first that can be merged as is? Being able to see it as a draft PR would be even more helpful.

from rspec-openapi.

k0kubun avatar k0kubun commented on June 10, 2024 1

It looks like none of your currently open pull requests has a test case at this point. If you accidentally dropped it, could you resurrect it? I think this repository should have a test that runs a Rails engine.

from rspec-openapi.

blocknotes avatar blocknotes commented on June 10, 2024 1

It looks like none of your currently open pull requests has a test case at this point. If you accidentally dropped it, could you resurrect it? I think this repository should have a test that runs a Rails engine.

You are right, I have just updated the PR with an engine test.
Please check the PR carefully when you have some time 🙏
It looks correct to me but it's a tricky part.

from rspec-openapi.

blocknotes avatar blocknotes commented on June 10, 2024

Thank you for reporting this. Since you already have a small reproduction code, could you also turn the issue directory into a working test case first that can be merged as is? Being able to see it as a draft PR would be even more helpful.

Sure => #38
It contains also a change to support the case where there's no controller (ex. a route with only a block) and the case of 404 routes (without raising an exception).

BTW, I'm not 100% convinced right now of the third commit (the engine fix) because if the relevant route is the first one it could be ignored in the iterations of the recognize block.

Also, at the moment, I don't know why recognize catch more routes than expected.
Investigating a bit:

app.routes.recognize_path(request.path_info, method: request.method)
# => {:controller=>"hello", :action=>"world"}

routes = []; app.routes.router.recognize(request) { |route| routes << route }; routes.count
# => 2
routes.map(&:name)
# => ["my_engine", "hello_world"]
routes.map(&:defaults)
# => [{}, {:controller=>"hello", :action=>"world"}]

from rspec-openapi.

k0kubun avatar k0kubun commented on June 10, 2024

Thank you for filing it. You're still not so sure about your current approach and you expect me to think about it, right? I don't have time to do that right away, so please allow me to find time to work on it.

from rspec-openapi.

blocknotes avatar blocknotes commented on June 10, 2024

Thank you for filing it. You're still not so sure about your current approach and you expect me to think about it, right? I don't have time to do that right away, so please allow me to find time to work on it.

Yeah, I think that the proposed fix is not optimal.
Perhaps I already found a failing edge case with it (I'm making my tests on a project with a lot of different requests).

But I will probably look for a better solution and keep you posted.

from rspec-openapi.

blocknotes avatar blocknotes commented on June 10, 2024

Update: I think I found a better solution - PR updated.
I made some trials and it looks good now.

Please let me know your opinion.

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.