api_schema 0.1.9.1 → 0.1.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 175bb9264dcf923158ad05b31808e0699700cb7b
4
- data.tar.gz: 5b5b6d436295f1addfcdb2186fc2341a5b5d14ca
3
+ metadata.gz: d2f3fa661280ba4f60948f92da8669f4013e1b63
4
+ data.tar.gz: 22769f27db184bb796ee0be2ba99dea47e3e03dc
5
5
  SHA512:
6
- metadata.gz: f33a130676995f9d8d81d0c3c2cb1ac5bdd37155dbbdb5d5b1f18b9a7cbc64b8f6c4659334c667a310a1028904a3a6b115748fad7a52f732b48becbba211724b
7
- data.tar.gz: 49d29e82afd8cd701acdc12d9cae5917197999c7e8f3b04402055f19c3634435e5c3e3546c7ba35a1ebaff3ec55fe1b6282fb202308ebc8a7f0f80fee97b6e16
6
+ metadata.gz: 52520e379c716b67a84f75a8903e2c89996db60b312017a57e7859f13ab4f77261c0452d8f26f6ee9a7cce085c8f885e05632b35f29663ff22204ebd92c982cc
7
+ data.tar.gz: fe7b458da9aee9e783cfaf5422896bc1bcae82968c79077580dd1df4d357abbd2831d214bd16dd5aff556e5487a34d7ecc06395b6854a7fb8294827bf4d6ac56
@@ -73,6 +73,11 @@ module ApiSchema
73
73
  raise "There is no '#{body_param}' body parameter defined for #{full_path} resource. Please define it with 'request_body' method"
74
74
  end
75
75
 
76
+ def response_defined?
77
+ return true if resp.model.nil? || api_version.serializers.detect {|s| s.id == resp.model }
78
+ raise "There is no '#{resp.model}' response defined for ''#{summary} resource'. Please define it with 'serializer' method"
79
+ end
80
+
76
81
  def with_errors?
77
82
  !errors.empty?
78
83
  end
@@ -107,7 +112,7 @@ module ApiSchema
107
112
  security do
108
113
  key :authorization, []
109
114
  end
110
- body_param(r.body_param) if r.with_body?
115
+ body_param(r.body_param) if r.with_body? && r.body_defined?
111
116
 
112
117
  r.header_params.each do |p|
113
118
  header_param(p.name, p.type, p.required)
@@ -119,7 +124,7 @@ module ApiSchema
119
124
  query_param(p.name, p.type, p.required)
120
125
  end
121
126
 
122
- success_response(r.resp.code, r.resp.model, r.resp.fields)
127
+ success_response(r.resp.code, r.resp.model, r.resp.fields) if r.response_defined?
123
128
  error_responses(error_model, error_desc, *r.errors) if r.with_errors?
124
129
  end
125
130
  end
@@ -1,3 +1,3 @@
1
1
  module ApiSchema
2
- VERSION = "0.1.9.1"
2
+ VERSION = "0.1.9.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9.1
4
+ version: 0.1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Chopey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-19 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport