diff --git a/app/blueprints/api/v1/error_blueprint.rb b/app/blueprints/api/v1/error_blueprint.rb new file mode 100644 index 0000000..92a9580 --- /dev/null +++ b/app/blueprints/api/v1/error_blueprint.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Api + module V1 + class ErrorBlueprint < Blueprinter::Base + field :error, if: ->(_field_name, _error, options) { options.key?(:error) } do |_, options| + options[:error] + end + + field :errors, if: ->(_field_name, _error, options) { options.key?(:errors) } do |_, options| + options[:errors] + end + end + end +end