graphiti-openapi 0.1.3 → 0.1.4
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 015cbe6aa63f308b61a42b8f078e964b563e565aab3d366073a7456864229a7e
|
4
|
+
data.tar.gz: b0ce59a632e8d31d0e6a09a7a05bdc8b350fbf1c271d76d71be5037d30ff3a64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efeb4935a85a9b49e8515ccbe0f3de6e3640316fc9828a4f6ddc46ed62cf286b657b437babb9e8b92cdbc1fdb5b5038403d807249b6bde1fec5e7217fc5529d2
|
7
|
+
data.tar.gz: f46970e19d111d1097d71a4e6ec0513a5e9e03323bdde1b236de98246e5eefab4534179f43461bb55bbd6436b0bf5898a4c78ba45dfd7a833a4a1aeaf9a9d563
|
@@ -6,7 +6,7 @@ module Graphiti::OpenAPI
|
|
6
6
|
respond_to do |format|
|
7
7
|
format.html
|
8
8
|
format.json { render json: generator.to_openapi }
|
9
|
-
format.yaml { render text: generator.to_openapi(format: :yaml) }
|
9
|
+
format.yaml { render text: generator.to_openapi(format: :yaml), layout: nil }
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -51,7 +51,7 @@ module Graphiti::OpenAPI
|
|
51
51
|
template = template_source.data
|
52
52
|
data = {
|
53
53
|
openapi: "3.0.1",
|
54
|
-
servers:
|
54
|
+
servers: servers,
|
55
55
|
tags: tags,
|
56
56
|
paths: paths,
|
57
57
|
components: {
|
@@ -76,6 +76,15 @@ module Graphiti::OpenAPI
|
|
76
76
|
|
77
77
|
private
|
78
78
|
|
79
|
+
def servers
|
80
|
+
[{url: "#{root_url}#{ApplicationResource.endpoint_namespace}", description: "#{Rails.env} server"}]
|
81
|
+
end
|
82
|
+
|
83
|
+
def root_url
|
84
|
+
url_options = Rails.application.routes.default_url_options
|
85
|
+
"#{url_options[:protocol]}://#{url_options[:host]}"
|
86
|
+
end
|
87
|
+
|
79
88
|
def tags
|
80
89
|
resources.values.map do |resource|
|
81
90
|
{
|
@@ -169,6 +178,6 @@ module Graphiti::OpenAPI
|
|
169
178
|
PREFIX_JSONAPI_DEFINITIONS[defs]
|
170
179
|
end
|
171
180
|
|
172
|
-
memoize :jsonapi_source, :jsonapi_definitions, :schema_source, :schema, :template_source
|
181
|
+
memoize :jsonapi_source, :jsonapi_definitions, :schema_source, :schema, :template_source, :root_url
|
173
182
|
end
|
174
183
|
end
|
@@ -12,6 +12,7 @@ module Graphiti::OpenAPI
|
|
12
12
|
TYPES_MAP = Hash.new do |hash, type|
|
13
13
|
hash[type] = {type: type}
|
14
14
|
end.merge(
|
15
|
+
big_decimal: {type: :numeric, format: :decimal},
|
15
16
|
hash: {type: :object, additionalProperties: true},
|
16
17
|
datetime: {type: :string, format: :'date-time'},
|
17
18
|
date: {type: :string, format: :date},
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiti-openapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Semyonov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|