From 6da5c9c194377a745e338813e0616bd35966bf56 Mon Sep 17 00:00:00 2001 From: Semyon Pupkov Date: Wed, 11 Jan 2017 16:46:16 +0500 Subject: [PATCH] fix: old UnproccesableError class does not work across alias https://github.com/abak-press/apress-api/issues/34 --- Gemfile | 1 + .../models/apress/api/unproccesable_error.rb | 15 +++++++++++- .../models/apress/api/unprocessable_error.rb | 24 ++++++++++++------- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 69f8892..2f0d585 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,7 @@ if RUBY_VERSION < '2' gem 'public_suffix', '< 1.5.0' gem 'pg', '< 0.19.0' gem "pry-debugger", ">= 0.2.3" + gem 'nokogiri', '< 1.7.0' else gem "test-unit" gem "pry-byebug" diff --git a/app/docs/swagger/v1/models/apress/api/unproccesable_error.rb b/app/docs/swagger/v1/models/apress/api/unproccesable_error.rb index 5488041..15fd049 100644 --- a/app/docs/swagger/v1/models/apress/api/unproccesable_error.rb +++ b/app/docs/swagger/v1/models/apress/api/unproccesable_error.rb @@ -1 +1,14 @@ -Swagger::V1::Models::Apress::Api::UnproccesableError = Swagger::V1::Models::Apress::Api::UnprocessableError +module Swagger + module V1 + module Models + module Apress + module Api + # Deprecated: Please use `UnprocessableError` instead + class UnproccesableError < ::Apress::Api::Swagger::Schema + include UnprocessableError::Schema + end + end + end + end + end +end diff --git a/app/docs/swagger/v1/models/apress/api/unprocessable_error.rb b/app/docs/swagger/v1/models/apress/api/unprocessable_error.rb index 7f52e73..dbdc274 100644 --- a/app/docs/swagger/v1/models/apress/api/unprocessable_error.rb +++ b/app/docs/swagger/v1/models/apress/api/unprocessable_error.rb @@ -4,19 +4,27 @@ module Models module Apress module Api class UnprocessableError < ::Apress::Api::Swagger::Schema - swagger_schema name.to_sym do - key :required, :errors + module Schema + extend ActiveSupport::Concern - property :errors do - key :type, :array - items do - key :type, :object - property :error do - key :type, :object + included do + swagger_schema name.to_sym do + key :required, :errors + + property :errors do + key :type, :array + items do + key :type, :object + property :error do + key :type, :object + end + end end end end end + + include Schema end end end