ahx / openapi_first

openapi_first is a Ruby gem for request / response validation and contract-testing against an OpenAPI API description. It makes APIFirst easy and reliable.
MIT License
115 stars 15 forks source link

Builtin middlewares trigger deprecation warnings. #254

Closed gobijan closed 5 months ago

gobijan commented 6 months ago

Hi, the builtin middlewares trigger deprecation warnings since the last relase.

I have a concern like this:

module OpenapiFirstEnabler extend ActiveSupport::Concern

included do if Rails.env.test? use OpenapiFirst::Middlewares::ResponseValidation, spec: Rails.root.join("public", "api", "v1", "openapi.yml") end

use OpenapiFirst::Middlewares::RequestValidation,
  spec: Rails.root.join("public", "api", "v1", "openapi.yml"),
  raise_error: false # Rails.env.test?

end end

The test suite is now spammed with deprecation warnings. Example:

[DEPRECATION] validate is deprecated. Please use OpenapiFirst.load('openapi.yaml').validate_request(rack_request) instead. [DEPRECATION] validate_response! is deprecated. Please use OpenapiFirst.load('openapi.yaml').validate_response(request, response, raise_error: false) instead.

Did I overlook something or shouldn't this be the case.

ahx commented 6 months ago

I overlooked something. Will release 1.4.1 tonight. Thanks for the report.

gobijan commented 6 months ago

Thx. Didn't want to create a PR before checking with you :)

ahx commented 5 months ago

I was looking into what cruft can be removed in 2.0 and was happy with making a release that deprecates some internally used methods before taking the chance to removing them in an 2.0 release. That did not work out in fully.

This is solved in 1.4.1.

gobijan commented 5 months ago

Works perfect! Thx :)