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 +4 -4
- data/lib/api_schema/resource_definition.rb +7 -2
- data/lib/api_schema/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f3fa661280ba4f60948f92da8669f4013e1b63
|
4
|
+
data.tar.gz: 22769f27db184bb796ee0be2ba99dea47e3e03dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/api_schema/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|