a-chacon / oas_rails

Generate Automatic Interactive Documentation for Your Rails API
GNU General Public License v3.0
69 stars 4 forks source link

Undefined method :D #29

Closed Metalzoid closed 3 months ago

Metalzoid commented 3 months ago

Hi ! It's me, again ! ahah

Ok, now, it works fine ! BUT ..

I've oauth routes discovered .. But don't see in your doc if i can desactivate custom route. So, i tryed to desactivate all responses autodiscover and specify manualy. i've this error :

Started GET "/docs.json" for ::1 at 2024-08-21 09:17:57 +0200
  Admin Load (0.2ms)  SELECT "admins".* FROM "admins" WHERE "admins"."id" = $1 ORDER BY "admins"."id" ASC LIMIT $2  [["id", 2], ["LIMIT", 1]]
Processing by OasRails::OasRailsController#index as JSON
Completed 500 Internal Server Error in 78ms (ActiveRecord: 0.0ms | Allocations: 60292)

NoMethodError (undefined method `add_default_responses' for nil):

oas_rails (0.4.4) lib/oas_rails/builders/operation_builder.rb:22:in `from_oas_route'
oas_rails (0.4.4) lib/oas_rails/builders/path_item_builder.rb:12:in `block (2 levels) in from_path'
oas_rails (0.4.4) lib/oas_rails/builders/path_item_builder.rb:11:in `each'
oas_rails (0.4.4) lib/oas_rails/builders/path_item_builder.rb:11:in `block in from_path'
oas_rails (0.4.4) lib/oas_rails/builders/path_item_builder.rb:10:in `each'
oas_rails (0.4.4) lib/oas_rails/builders/path_item_builder.rb:10:in `from_path'
oas_rails (0.4.4) lib/oas_rails/spec/paths.rb:14:in `add_path'
oas_rails (0.4.4) lib/oas_rails/spec/specification.rb:25:in `block in build'
oas_rails (0.4.4) lib/oas_rails/spec/specification.rb:24:in `each'
oas_rails (0.4.4) lib/oas_rails/spec/specification.rb:24:in `build'
oas_rails (0.4.4) lib/oas_rails.rb:60:in `build'
oas_rails (0.4.4) app/controllers/oas_rails/oas_rails_controller.rb:9:in `block (2 levels) in index'
actionpack (7.1.3.4) lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
oas_rails (0.4.4) app/controllers/oas_rails/oas_rails_controller.rb:6:in `index'
actionpack (7.1.3.4) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (7.1.3.4) lib/abstract_controller/base.rb:224:in `process_action'
actionpack (7.1.3.4) lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack (7.1.3.4) lib/abstract_controller/callbacks.rb:259:in `block in process_action'
activesupport (7.1.3.4) lib/active_support/callbacks.rb:121:in `block in run_callbacks'
turbo-rails (2.0.6) lib/turbo-rails.rb:24:in `with_request_id'
turbo-rails (2.0.6) app/controllers/concerns/turbo/request_id_tracking.rb:10:in `turbo_tracking_request_id'
activesupport (7.1.3.4) lib/active_support/callbacks.rb:130:in `block in run_callbacks'
actiontext (7.1.3.4) lib/action_text/rendering.rb:23:in `with_renderer'
actiontext (7.1.3.4) lib/action_text/engine.rb:69:in `block (4 levels) in <class:Engine>'
activesupport (7.1.3.4) lib/active_support/callbacks.rb:130:in `instance_exec'
activesupport (7.1.3.4) lib/active_support/callbacks.rb:130:in `block in run_callbacks'
activesupport (7.1.3.4) lib/active_support/callbacks.rb:141:in `run_callbacks'
actionpack (7.1.3.4) lib/abstract_controller/callbacks.rb:258:in `process_action'
actionpack (7.1.3.4) lib/action_controller/metal/rescue.rb:25:in `process_action'
actionpack (7.1.3.4) lib/action_controller/metal/instrumentation.rb:74:in `block in process_action'
activesupport (7.1.3.4) lib/active_support/notifications.rb:206:in `block in instrument'
activesupport (7.1.3.4) lib/active_support/notifications/instrumenter.rb:58:in `instrument'
activesupport (7.1.3.4) lib/active_support/notifications.rb:206:in `instrument'
actionpack (7.1.3.4) lib/action_controller/metal/instrumentation.rb:73:in `process_action'
actionpack (7.1.3.4) lib/action_controller/metal/params_wrapper.rb:261:in `process_action'
activerecord (7.1.3.4) lib/active_record/railties/controller_runtime.rb:32:in `process_action'
actionpack (7.1.3.4) lib/abstract_controller/base.rb:160:in `process'
actionview (7.1.3.4) lib/action_view/rendering.rb:40:in `process'
actionpack (7.1.3.4) lib/action_controller/metal.rb:227:in `dispatch'
actionpack (7.1.3.4) lib/action_controller/metal.rb:309:in `dispatch'
actionpack (7.1.3.4) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.1.3.4) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:51:in `block in serve'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:131:in `block in find_routes'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:124:in `each'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:124:in `find_routes'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.1.3.4) lib/action_dispatch/routing/route_set.rb:882:in `call'
railties (7.1.3.4) lib/rails/engine.rb:536:in `call'
railties (7.1.3.4) lib/rails/railtie.rb:226:in `public_send'
railties (7.1.3.4) lib/rails/railtie.rb:226:in `method_missing'
actionpack (7.1.3.4) lib/action_dispatch/routing/mapper.rb:22:in `block in <class:Constraints>'
actionpack (7.1.3.4) lib/action_dispatch/routing/mapper.rb:51:in `serve'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:51:in `block in serve'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:131:in `block in find_routes'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:124:in `each'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:124:in `find_routes'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.1.3.4) lib/action_dispatch/routing/route_set.rb:882:in `call'
omniauth (2.1.2) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.2) lib/omniauth/strategy.rb:169:in `call'
omniauth (2.1.2) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.2) lib/omniauth/strategy.rb:169:in `call'
warden-jwt_auth (0.10.0) lib/warden/jwt_auth/middleware/token_dispatcher.rb:20:in `call'
warden-jwt_auth (0.10.0) lib/warden/jwt_auth/middleware/revocation_manager.rb:21:in `call'
rack (3.1.7) lib/rack/builder.rb:277:in `call'
warden-jwt_auth (0.10.0) lib/warden/jwt_auth/middleware.rb:22:in `call'
rack-attack (6.7.0) lib/rack/attack.rb:127:in `call'
rack (3.1.7) lib/rack/method_override.rb:28:in `call'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:272:in `context'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:266:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/cookies.rb:689:in `call'
warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
warden (1.2.9) lib/warden/manager.rb:34:in `catch'
warden (1.2.9) lib/warden/manager.rb:34:in `call'
rack (3.1.7) lib/rack/tempfile_reaper.rb:20:in `call'
rack (3.1.7) lib/rack/etag.rb:29:in `call'
rack (3.1.7) lib/rack/conditional_get.rb:31:in `call'
rack (3.1.7) lib/rack/head.rb:15:in `call'
actionpack (7.1.3.4) lib/action_dispatch/http/permissions_policy.rb:36:in `call'
actionpack (7.1.3.4) lib/action_dispatch/http/content_security_policy.rb:33:in `call'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:272:in `context'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:266:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/cookies.rb:689:in `call'
activerecord (7.1.3.4) lib/active_record/migration.rb:655:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (7.1.3.4) lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack (7.1.3.4) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/actionable_exceptions.rb:16:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (7.1.3.4) lib/rails/rack/logger.rb:37:in `call_app'
railties (7.1.3.4) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (7.1.3.4) lib/active_support/tagged_logging.rb:135:in `block in tagged'
activesupport (7.1.3.4) lib/active_support/tagged_logging.rb:39:in `tagged'
activesupport (7.1.3.4) lib/active_support/tagged_logging.rb:135:in `tagged'
activesupport (7.1.3.4) lib/active_support/broadcast_logger.rb:240:in `method_missing'
railties (7.1.3.4) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.5.2) lib/sprockets/rails/quiet_assets.rb:17:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/remote_ip.rb:92:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/request_id.rb:28:in `call'
rack (3.1.7) lib/rack/method_override.rb:28:in `call'
rack (3.1.7) lib/rack/runtime.rb:24:in `call'
activesupport (7.1.3.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/server_timing.rb:59:in `block in call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/server_timing.rb:24:in `collect_events'
actionpack (7.1.3.4) lib/action_dispatch/middleware/server_timing.rb:58:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/static.rb:25:in `call'
rack (3.1.7) lib/rack/sendfile.rb:114:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/host_authorization.rb:141:in `call'
rack-cors (2.0.2) lib/rack/cors.rb:102:in `call'
railties (7.1.3.4) lib/rails/engine.rb:536:in `call'
puma (6.4.2) lib/puma/configuration.rb:272:in `call'
puma (6.4.2) lib/puma/request.rb:100:in `block in handle_request'
puma (6.4.2) lib/puma/thread_pool.rb:378:in `with_force_shutdown'
puma (6.4.2) lib/puma/request.rb:99:in `handle_request'
puma (6.4.2) lib/puma/server.rb:464:in `process_client'
puma (6.4.2) lib/puma/server.rb:245:in `block in run'
puma (6.4.2) lib/puma/thread_pool.rb:155:in `block in spawn_thread'
activerecord (7.1.3.4) lib/active_record/railties/controller_runtime.rb:32:in `process_action'
actionpack (7.1.3.4) lib/abstract_controller/base.rb:160:in `process'
actionview (7.1.3.4) lib/action_view/rendering.rb:40:in `process'
actionpack (7.1.3.4) lib/action_controller/metal.rb:227:in `dispatch'
actionpack (7.1.3.4) lib/action_controller/metal.rb:309:in `dispatch'
actionpack (7.1.3.4) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (7.1.3.4) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:51:in `block in serve'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:131:in `block in find_routes'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:124:in `each'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:124:in `find_routes'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.1.3.4) lib/action_dispatch/routing/route_set.rb:882:in `call'
railties (7.1.3.4) lib/rails/engine.rb:536:in `call'
railties (7.1.3.4) lib/rails/railtie.rb:226:in `public_send'
railties (7.1.3.4) lib/rails/railtie.rb:226:in `method_missing'
actionpack (7.1.3.4) lib/action_dispatch/routing/mapper.rb:22:in `block in <class:Constraints>'
actionpack (7.1.3.4) lib/action_dispatch/routing/mapper.rb:51:in `serve'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:51:in `block in serve'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:131:in `block in find_routes'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:124:in `each'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:124:in `find_routes'
actionpack (7.1.3.4) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (7.1.3.4) lib/action_dispatch/routing/route_set.rb:882:in `call'
omniauth (2.1.2) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.2) lib/omniauth/strategy.rb:169:in `call'
omniauth (2.1.2) lib/omniauth/strategy.rb:202:in `call!'
omniauth (2.1.2) lib/omniauth/strategy.rb:169:in `call'
warden-jwt_auth (0.10.0) lib/warden/jwt_auth/middleware/token_dispatcher.rb:20:in `call'
warden-jwt_auth (0.10.0) lib/warden/jwt_auth/middleware/revocation_manager.rb:21:in `call'
rack (3.1.7) lib/rack/builder.rb:277:in `call'
warden-jwt_auth (0.10.0) lib/warden/jwt_auth/middleware.rb:22:in `call'
rack-attack (6.7.0) lib/rack/attack.rb:127:in `call'
rack (3.1.7) lib/rack/method_override.rb:28:in `call'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:272:in `context'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:266:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/cookies.rb:689:in `call'
warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
warden (1.2.9) lib/warden/manager.rb:34:in `catch'
warden (1.2.9) lib/warden/manager.rb:34:in `call'
rack (3.1.7) lib/rack/tempfile_reaper.rb:20:in `call'
rack (3.1.7) lib/rack/etag.rb:29:in `call'
rack (3.1.7) lib/rack/conditional_get.rb:31:in `call'
rack (3.1.7) lib/rack/head.rb:15:in `call'
actionpack (7.1.3.4) lib/action_dispatch/http/permissions_policy.rb:36:in `call'
actionpack (7.1.3.4) lib/action_dispatch/http/content_security_policy.rb:33:in `call'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:272:in `context'
rack-session (2.0.0) lib/rack/session/abstract/id.rb:266:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/cookies.rb:689:in `call'
activerecord (7.1.3.4) lib/active_record/migration.rb:655:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (7.1.3.4) lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack (7.1.3.4) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/actionable_exceptions.rb:16:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (7.1.3.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'

SO, i tryed to disable "set_default_responses", the same error.

And another problem, I have the default response 204 without content, but I don't want it ^^ And if I want to document my controller, I can't because it is displayed in the doc :(

Thanks :) (and sorry again :( )

a-chacon commented 3 months ago

Hi @Metalzoid ! It is perfect that you report to me this, I was hoping someone do it because I just tested this on my apps and nowhere else. So don't be shy and open any issue you find.

Can you please open two more issues? One for a feature request about excluding custom routes and another for remove the 204 content response. And try to give me an expected behavior and implementation(ex: a config array where put the excluded routes). (If you want, you can help me to resolve the issues)

And about the undefined method error, I will inspect and resolve it asap. Be patient, I want to make it works fine.