lib/fakeit/app/routes/openapi_route.rb in fakeit-0.7.1 vs lib/fakeit/app/routes/openapi_route.rb in fakeit-0.8.0

- old
+ new

@@ -1,12 +1,10 @@ module Fakeit module App module Routes class OpenapiRoute - def initialize(spec_file) - @specification = Fakeit::Openapi::Specification.new(spec_file) - end + def initialize(spec_file) = @specification = Fakeit::Openapi::Specification.new(spec_file) def call(request, options) @specification .operation(request.request_method.downcase.to_sym, request.path_info, options) .then { _1 ? handle(_1, request, options) : Fakeit::App::Helpers::ResponseBuilder.not_found } @@ -20,12 +18,10 @@ rescue Fakeit::Validation::ValidationError => e Logger.warn(Rainbow(e.message).red) options.permissive ? response(operation) : Fakeit::App::Helpers::ResponseBuilder.error(418, e) end - def response(operation) - [operation.status, operation.headers, [operation.body]] - end + def response(operation) = [operation.status, operation.headers, [operation.body]] def validate(operation, request) operation.validate( body: Helpers::BodyParser.parse(request), params: parse_query(request.query_string),