bullet_train-api 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/open_api_controller.rb +59 -0
- data/app/views/api/v1/open_api/index.yaml.erb +29 -0
- data/app/views/api/v1/open_api/scaffolding/completely_concrete/tangible_things/_components.yaml.erb +32 -0
- data/app/views/api/v1/open_api/scaffolding/completely_concrete/tangible_things/_paths.yaml.erb +55 -0
- data/app/views/api/v1/open_api/teams/_paths.yaml.erb +55 -0
- data/app/views/api/v1/open_api/users/_paths.yaml.erb +55 -0
- data/config/routes.rb +2 -0
- data/lib/bullet_train/api/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3367b24861a1093a4db3caf19e83d306aec61ce8785d06311e06f193814b7f11
|
4
|
+
data.tar.gz: 18ceefe7b0aa58202f66e6f27d970583d0c77bfc8021db09877607f323f9476a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dec4c4b5a4128dc297b23c594c8ed240fdb0202d2eaa38c9276956e88301f56572c3f05be3ad9ee39488d14ec993bf305385979220a1437147bb3e20d0ecb679
|
7
|
+
data.tar.gz: 7e1ed3894051f4a2a0db6cd1fb374e8f0af0883d72050c15a746fb47f3147963caf4f338f8adf2c2204527a51db27f391605ff0ed7ce0da7b043598a9edf123e
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module OpenApiHelper
|
2
|
+
def indent(string, count)
|
3
|
+
lines = string.lines
|
4
|
+
first_line = lines.shift
|
5
|
+
lines = lines.map { |line| (" " * count).to_s + line }
|
6
|
+
lines.unshift(first_line).join.html_safe
|
7
|
+
end
|
8
|
+
|
9
|
+
def components_for(model)
|
10
|
+
for_model model do
|
11
|
+
indent(render("api/#{@version}/open_api/#{model.name.underscore.pluralize}/components"), 2)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def current_model
|
16
|
+
@model_stack.last
|
17
|
+
end
|
18
|
+
|
19
|
+
def for_model(model)
|
20
|
+
@model_stack ||= []
|
21
|
+
@model_stack << model
|
22
|
+
result = yield
|
23
|
+
@model_stack.pop
|
24
|
+
result
|
25
|
+
end
|
26
|
+
|
27
|
+
def paths_for(model)
|
28
|
+
for_model model do
|
29
|
+
indent(render("api/#{@version}/open_api/#{model.name.underscore.pluralize}/paths"), 1)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def attribute(attribute)
|
34
|
+
heading = t("#{current_model.name.underscore.pluralize}.fields.#{attribute}.heading")
|
35
|
+
# TODO A lot of logic to be done here.
|
36
|
+
indent("#{attribute}:\n description: \"#{heading}\"\n type: string", 2)
|
37
|
+
end
|
38
|
+
|
39
|
+
def parameter(attribute)
|
40
|
+
heading = t("#{current_model.name.underscore.pluralize}.fields.#{attribute}.heading")
|
41
|
+
# TODO A lot of logic to be done here.
|
42
|
+
indent("#{attribute}:\n description: \"#{heading}\"\n type: string", 2)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Api::OpenApiController < ApplicationController
|
47
|
+
helper :open_api
|
48
|
+
|
49
|
+
def set_default_response_format
|
50
|
+
request.format = :yaml
|
51
|
+
end
|
52
|
+
|
53
|
+
before_action :set_default_response_format
|
54
|
+
|
55
|
+
def index
|
56
|
+
@version = params[:version]
|
57
|
+
render "api/#{@version}/open_api/index", layout: nil, format: :text
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
openapi: 3.1.0
|
2
|
+
info:
|
3
|
+
title: Bullet Train API
|
4
|
+
description: |
|
5
|
+
The baseline API of a new Bullet Train application.
|
6
|
+
license:
|
7
|
+
name: MIT
|
8
|
+
url: https://opensource.org/licenses/MIT
|
9
|
+
version: "<%= @version.upcase %>"
|
10
|
+
servers:
|
11
|
+
- url: <%= ENV["BASE_URL"] %>/api/<%= @version %>
|
12
|
+
components:
|
13
|
+
schemas:
|
14
|
+
<%= components_for Team %>
|
15
|
+
<%= components_for User %>
|
16
|
+
<%= components_for Scaffolding::CompletelyConcrete::TangibleThing unless scaffolding_things_disabled? %>
|
17
|
+
<%# 🚅 super scaffolding will insert new components above this line. %>
|
18
|
+
parameters:
|
19
|
+
id:
|
20
|
+
name: id
|
21
|
+
in: path
|
22
|
+
required: true
|
23
|
+
schema:
|
24
|
+
type: string
|
25
|
+
paths:
|
26
|
+
<%= paths_for Team %>
|
27
|
+
<%= paths_for User %>
|
28
|
+
<%= paths_for Scaffolding::CompletelyConcrete::TangibleThing unless scaffolding_things_disabled? %>
|
29
|
+
<%# 🚅 super scaffolding will insert new paths above this line. %>
|
data/app/views/api/v1/open_api/scaffolding/completely_concrete/tangible_things/_components.yaml.erb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
Scaffolding::CompletelyConcrete::TangibleThing::Attributes:
|
2
|
+
type: object
|
3
|
+
properties:
|
4
|
+
<%= attribute :id %>
|
5
|
+
<%= attribute :absolutely_abstract_creative_concept_id %>
|
6
|
+
<%# 🚅 skip this section when scaffolding. %>
|
7
|
+
<%= attribute :text_field_value %>
|
8
|
+
<%= attribute :button_value %>
|
9
|
+
<%= attribute :boolean_button_value %>
|
10
|
+
<%= attribute :cloudinary_image_value %>
|
11
|
+
<%= attribute :date_field_value %>
|
12
|
+
<%= attribute :email_field_value %>
|
13
|
+
<%= attribute :file_field_value %>
|
14
|
+
<%= attribute :password_field_value %>
|
15
|
+
<%= attribute :phone_field_value %>
|
16
|
+
<%= attribute :option_value %>
|
17
|
+
<%= attribute :multiple_option_values %>
|
18
|
+
<%= attribute :super_select_value %>
|
19
|
+
<%= attribute :text_area_value %>
|
20
|
+
<%= attribute :action_text_value %>
|
21
|
+
<%# 🚅 stop any skipping we're doing now. %>
|
22
|
+
<%# 🚅 super scaffolding will insert new attributes above this line. %>
|
23
|
+
<%= attribute :created_at %>
|
24
|
+
<%= attribute :updated_at %>
|
25
|
+
|
26
|
+
Scaffolding::CompletelyConcrete::TangibleThing::Parameters:
|
27
|
+
type: object
|
28
|
+
properties:
|
29
|
+
<%# 🚅 skip this section when scaffolding. %>
|
30
|
+
<%= parameter :text_field_value %>
|
31
|
+
<%# 🚅 stop any skipping we're doing now. %>
|
32
|
+
<%# 🚅 super scaffolding will insert new parameter above this line. %>
|
data/app/views/api/v1/open_api/scaffolding/completely_concrete/tangible_things/_paths.yaml.erb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
/scaffolding/completely_concrete/tangible_things:
|
2
|
+
get:
|
3
|
+
tags:
|
4
|
+
- Scaffolding Completely Concrete Tangible Things
|
5
|
+
summary: "List Tangible Things"
|
6
|
+
operationId: listScaffoldingCompletelyConcreteTangibleThings
|
7
|
+
responses:
|
8
|
+
"404":
|
9
|
+
description: "Not Found"
|
10
|
+
"200":
|
11
|
+
description: "OK"
|
12
|
+
content:
|
13
|
+
application/json:
|
14
|
+
schema:
|
15
|
+
type: object
|
16
|
+
properties:
|
17
|
+
data:
|
18
|
+
type: array
|
19
|
+
items:
|
20
|
+
$ref: "#/components/schemas/Scaffolding::CompletelyConcrete::TangibleThing::Attributes"
|
21
|
+
has_more:
|
22
|
+
type: boolean
|
23
|
+
/scaffolding/completely_concrete/tangible_things/{id}:
|
24
|
+
get:
|
25
|
+
tags:
|
26
|
+
- Scaffolding Completely Concrete Tangible Things
|
27
|
+
summary: "Fetch Tangible Thing"
|
28
|
+
operationId: getScaffoldingCompletelyConcreteTangibleThings
|
29
|
+
parameters:
|
30
|
+
- $ref: "#/components/parameters/id"
|
31
|
+
responses:
|
32
|
+
"404":
|
33
|
+
description: "Not Found"
|
34
|
+
"200":
|
35
|
+
description: "OK"
|
36
|
+
content:
|
37
|
+
application/json:
|
38
|
+
schema:
|
39
|
+
$ref: "#/components/schemas/Scaffolding::CompletelyConcrete::TangibleThing::Attributes"
|
40
|
+
put:
|
41
|
+
tags:
|
42
|
+
- Scaffolding Completely Concrete Tangible Things
|
43
|
+
summary: "Update Tangible Thing"
|
44
|
+
operationId: updateScaffoldingCompletelyConcreteTangibleThings
|
45
|
+
parameters:
|
46
|
+
- $ref: "#/components/parameters/id"
|
47
|
+
responses:
|
48
|
+
"404":
|
49
|
+
description: "Not Found"
|
50
|
+
"200":
|
51
|
+
description: "OK"
|
52
|
+
content:
|
53
|
+
application/json:
|
54
|
+
schema:
|
55
|
+
$ref: "#/components/schemas/Scaffolding::CompletelyConcrete::TangibleThing::Parameters"
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/teams:
|
2
|
+
get:
|
3
|
+
tags:
|
4
|
+
- Teams
|
5
|
+
summary: "List Teams"
|
6
|
+
operationId: listTeams
|
7
|
+
responses:
|
8
|
+
"404":
|
9
|
+
description: "Not Found"
|
10
|
+
"200":
|
11
|
+
description: "OK"
|
12
|
+
content:
|
13
|
+
application/json:
|
14
|
+
schema:
|
15
|
+
type: object
|
16
|
+
properties:
|
17
|
+
data:
|
18
|
+
type: array
|
19
|
+
items:
|
20
|
+
$ref: "#/components/schemas/Team::Attributes"
|
21
|
+
has_more:
|
22
|
+
type: boolean
|
23
|
+
/teams/{id}:
|
24
|
+
get:
|
25
|
+
tags:
|
26
|
+
- Teams
|
27
|
+
summary: "Fetch Team"
|
28
|
+
operationId: fetchTeam
|
29
|
+
parameters:
|
30
|
+
- $ref: "#/components/parameters/id"
|
31
|
+
responses:
|
32
|
+
"404":
|
33
|
+
description: "Not Found"
|
34
|
+
"200":
|
35
|
+
description: "OK"
|
36
|
+
content:
|
37
|
+
application/json:
|
38
|
+
schema:
|
39
|
+
$ref: "#/components/schemas/Team::Attributes"
|
40
|
+
put:
|
41
|
+
tags:
|
42
|
+
- Teams
|
43
|
+
summary: "Update Team"
|
44
|
+
operationId: updateTeam
|
45
|
+
parameters:
|
46
|
+
- $ref: "#/components/parameters/id"
|
47
|
+
responses:
|
48
|
+
"404":
|
49
|
+
description: "Not Found"
|
50
|
+
"200":
|
51
|
+
description: "OK"
|
52
|
+
content:
|
53
|
+
application/json:
|
54
|
+
schema:
|
55
|
+
$ref: "#/components/schemas/Team::Parameters"
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/users:
|
2
|
+
get:
|
3
|
+
tags:
|
4
|
+
- Users
|
5
|
+
summary: "List Users"
|
6
|
+
operationId: listUsers
|
7
|
+
responses:
|
8
|
+
"404":
|
9
|
+
description: "Not Found"
|
10
|
+
"200":
|
11
|
+
description: "OK"
|
12
|
+
content:
|
13
|
+
application/json:
|
14
|
+
schema:
|
15
|
+
type: object
|
16
|
+
properties:
|
17
|
+
data:
|
18
|
+
type: array
|
19
|
+
items:
|
20
|
+
$ref: "#/components/schemas/User::Attributes"
|
21
|
+
has_more:
|
22
|
+
type: boolean
|
23
|
+
/users/{id}:
|
24
|
+
get:
|
25
|
+
tags:
|
26
|
+
- Users
|
27
|
+
summary: "Fetch User"
|
28
|
+
operationId: fetchUser
|
29
|
+
parameters:
|
30
|
+
- $ref: "#/components/parameters/id"
|
31
|
+
responses:
|
32
|
+
"404":
|
33
|
+
description: "Not Found"
|
34
|
+
"200":
|
35
|
+
description: "OK"
|
36
|
+
content:
|
37
|
+
application/json:
|
38
|
+
schema:
|
39
|
+
$ref: "#/components/schemas/User::Attributes"
|
40
|
+
put:
|
41
|
+
tags:
|
42
|
+
- Users
|
43
|
+
summary: "Update User"
|
44
|
+
operationId: updateUser
|
45
|
+
parameters:
|
46
|
+
- $ref: "#/components/parameters/id"
|
47
|
+
responses:
|
48
|
+
"404":
|
49
|
+
description: "Not Found"
|
50
|
+
"200":
|
51
|
+
description: "OK"
|
52
|
+
content:
|
53
|
+
application/json:
|
54
|
+
schema:
|
55
|
+
$ref: "#/components/schemas/User::Parameters"
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- app/assets/config/bullet_train_api_manifest.js
|
123
123
|
- app/controllers/account/platform/access_tokens_controller.rb
|
124
124
|
- app/controllers/account/platform/applications_controller.rb
|
125
|
+
- app/controllers/api/open_api_controller.rb
|
125
126
|
- app/controllers/api/v1/platform/access_tokens_controller.rb
|
126
127
|
- app/controllers/concerns/api/controllers/base.rb
|
127
128
|
- app/controllers/concerns/api/v1/teams/controller_base.rb
|
@@ -147,6 +148,11 @@ files:
|
|
147
148
|
- app/views/account/platform/applications/new.html.erb
|
148
149
|
- app/views/account/platform/applications/show.html.erb
|
149
150
|
- app/views/account/platform/applications/show.json.jbuilder
|
151
|
+
- app/views/api/v1/open_api/index.yaml.erb
|
152
|
+
- app/views/api/v1/open_api/scaffolding/completely_concrete/tangible_things/_components.yaml.erb
|
153
|
+
- app/views/api/v1/open_api/scaffolding/completely_concrete/tangible_things/_paths.yaml.erb
|
154
|
+
- app/views/api/v1/open_api/teams/_paths.yaml.erb
|
155
|
+
- app/views/api/v1/open_api/users/_paths.yaml.erb
|
150
156
|
- app/views/api/v1/platform/access_tokens/_access_token.json.jbuilder
|
151
157
|
- app/views/api/v1/platform/access_tokens/index.json.jbuilder
|
152
158
|
- app/views/api/v1/platform/access_tokens/show.json.jbuilder
|