skyward-api 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +60 -56
- data/lib/skyward/api/assembly/boot.rb +239 -91
- data/lib/skyward/api/assembly/builder.rb +2 -2
- data/lib/skyward/api/assembly/dispatcher.rb +12 -12
- data/lib/skyward/api/assembly/static.rb +36 -36
- data/lib/skyward/api/cli/app_file.rb +2 -2
- data/lib/skyward/api/cli/check.rb +9 -9
- data/lib/skyward/api/cli/routes.rb +2 -2
- data/lib/skyward/api/cli/serve/reloader.rb +6 -6
- data/lib/skyward/api/cli/serve.rb +15 -15
- data/lib/skyward/api/cli/serve.ru +2 -2
- data/lib/skyward/api/commands.rb +10 -10
- data/lib/skyward/api/endpoints/declarations.rb +7 -3
- data/lib/skyward/api/endpoints/route.rb +3 -1
- data/lib/skyward/api/inputs/coercer.rb +53 -20
- data/lib/skyward/api/inputs.rb +9 -9
- data/lib/skyward/api/middleware/request_id.rb +3 -3
- data/lib/skyward/api/middleware/request_log.rb +5 -5
- data/lib/skyward/api/middleware/rescue.rb +7 -7
- data/lib/skyward/api/openapi/docs.rb +5 -5
- data/lib/skyward/api/openapi.rb +52 -50
- data/lib/skyward/api/request.rb +8 -8
- data/lib/skyward/api/routing/percent_encoding.rb +1 -1
- data/lib/skyward/api/routing/router.rb +68 -27
- data/lib/skyward/api/serializer/writers.rb +27 -16
- data/lib/skyward/api/serializer.rb +39 -21
- data/lib/skyward/api/test/client.rb +25 -25
- data/lib/skyward/api/version.rb +1 -1
- data/lib/skyward/api.rb +15 -14
- data/sig/generated/skyward/api/assembly/boot.rbs +99 -29
- data/sig/generated/skyward/api/endpoints/route.rbs +8 -4
- data/sig/generated/skyward/api/inputs/coercer.rbs +20 -2
- data/sig/generated/skyward/api/routing/router.rbs +52 -9
- data/sig/generated/skyward/api/serializer/writers.rbs +6 -0
- data/sig/generated/skyward/api/serializer.rbs +13 -1
- metadata +19 -4
- /data/sig/{manual/zeitwerk/loader.rbs → _private/zeitwerk.rbs} +0 -0
|
@@ -15,6 +15,21 @@ module Skyward::API::Assembly::Boot
|
|
|
15
15
|
# untyped, which is what rbs-inline writes for a method with no annotations.
|
|
16
16
|
ANY: RBS::Types::Bases::Any
|
|
17
17
|
|
|
18
|
+
class Refusal < Data
|
|
19
|
+
attr_reader problem(): String
|
|
20
|
+
|
|
21
|
+
attr_reader spots(): Array[Skyward::Core::Diagnostics::Spot]
|
|
22
|
+
|
|
23
|
+
attr_reader hint(): String?
|
|
24
|
+
|
|
25
|
+
def self.new: (String problem, Array[Skyward::Core::Diagnostics::Spot] spots, String? hint) -> instance
|
|
26
|
+
| (problem: String, spots: Array[Skyward::Core::Diagnostics::Spot], hint: String?) -> instance
|
|
27
|
+
|
|
28
|
+
def self.members: () -> [ :problem, :spots, :hint ]
|
|
29
|
+
|
|
30
|
+
def members: () -> [ :problem, :spots, :hint ]
|
|
31
|
+
end
|
|
32
|
+
|
|
18
33
|
# @rbs (Array[Skyward::API::Assembly::Builder::Mount] mounts,
|
|
19
34
|
# providers: Hash[Symbol, Skyward::API::_Provider & Object], reader: Skyward::Core::Types::Reader,
|
|
20
35
|
# max_body_size: Integer, strict: bool) ->
|
|
@@ -36,16 +51,39 @@ module Skyward::API::Assembly::Boot
|
|
|
36
51
|
|
|
37
52
|
# @rbs mount: Skyward::API::Assembly::Builder::Mount
|
|
38
53
|
# @rbs route: Skyward::API::Endpoints::Route
|
|
39
|
-
# @rbs built: Array[Skyward::API::Routing::Router::Endpoint]
|
|
54
|
+
# @rbs built: Array[[Skyward::API::Endpoints::Route, Skyward::API::Routing::Router::Endpoint]]
|
|
40
55
|
# @rbs providers: Hash[Symbol, Skyward::API::Routing::Router::Provider]
|
|
41
56
|
# @rbs reader: Skyward::Core::Types::Reader
|
|
42
57
|
# @rbs max_body_size: Integer
|
|
43
58
|
# @rbs return: Skyward::API::Routing::Router::Endpoint
|
|
44
|
-
def boot: (Skyward::API::Assembly::Builder::Mount mount, Skyward::API::Endpoints::Route route, Array[Skyward::API::Routing::Router::Endpoint] built, Hash[Symbol, Skyward::API::Routing::Router::Provider] providers, Skyward::Core::Types::Reader reader, Integer max_body_size) -> Skyward::API::Routing::Router::Endpoint
|
|
59
|
+
def boot: (Skyward::API::Assembly::Builder::Mount mount, Skyward::API::Endpoints::Route route, Array[[ Skyward::API::Endpoints::Route, Skyward::API::Routing::Router::Endpoint ]] built, Hash[Symbol, Skyward::API::Routing::Router::Provider] providers, Skyward::Core::Types::Reader reader, Integer max_body_size) -> Skyward::API::Routing::Router::Endpoint
|
|
60
|
+
|
|
61
|
+
# Core's own errors carry their excerpt in their message, already indented,
|
|
62
|
+
# so every line but an excerpt's is indented under the label.
|
|
63
|
+
# @rbs label: String
|
|
64
|
+
# @rbs refusal: Refusal
|
|
65
|
+
# @rbs return: String
|
|
66
|
+
def explained: (String label, Refusal refusal) -> String
|
|
67
|
+
|
|
68
|
+
# @rbs problem: String
|
|
69
|
+
# @rbs spots: Array[Skyward::Core::Diagnostics::Spot?]
|
|
70
|
+
# @rbs hint: String?
|
|
71
|
+
# @rbs return: Refusal
|
|
72
|
+
def refused: (String problem, ?spots: Array[Skyward::Core::Diagnostics::Spot?], ?hint: String?) -> Refusal
|
|
45
73
|
|
|
46
74
|
# @rbs route: Skyward::API::Endpoints::Route
|
|
47
|
-
# @rbs
|
|
48
|
-
|
|
75
|
+
# @rbs key: Symbol
|
|
76
|
+
# @rbs return: Skyward::Core::Diagnostics::Spot?
|
|
77
|
+
def argument: (Skyward::API::Endpoints::Route route, Symbol key) -> Skyward::Core::Diagnostics::Spot?
|
|
78
|
+
|
|
79
|
+
# @rbs route: Skyward::API::Endpoints::Route
|
|
80
|
+
# @rbs part: String
|
|
81
|
+
# @rbs return: Skyward::Core::Diagnostics::Spot?
|
|
82
|
+
def in_path: (Skyward::API::Endpoints::Route route, String part) -> Skyward::Core::Diagnostics::Spot?
|
|
83
|
+
|
|
84
|
+
# @rbs route: Skyward::API::Endpoints::Route
|
|
85
|
+
# @rbs return: Refusal?
|
|
86
|
+
def summary: (Skyward::API::Endpoints::Route route) -> Refusal?
|
|
49
87
|
|
|
50
88
|
# @rbs prefix: String
|
|
51
89
|
# @rbs path: String
|
|
@@ -56,11 +94,12 @@ module Skyward::API::Assembly::Boot
|
|
|
56
94
|
# @rbs return: Array[String | Symbol]
|
|
57
95
|
def pattern: (String path) -> Array[String | Symbol]
|
|
58
96
|
|
|
97
|
+
# @rbs route: Skyward::API::Endpoints::Route
|
|
59
98
|
# @rbs verb: String
|
|
60
99
|
# @rbs pattern: Array[String | Symbol]
|
|
61
|
-
# @rbs built: Array[Skyward::API::Routing::Router::Endpoint]
|
|
62
|
-
# @rbs return:
|
|
63
|
-
def shadowing: (String verb, Array[String | Symbol] pattern, Array[Skyward::API::Routing::Router::Endpoint] built) ->
|
|
100
|
+
# @rbs built: Array[[Skyward::API::Endpoints::Route, Skyward::API::Routing::Router::Endpoint]]
|
|
101
|
+
# @rbs return: Refusal?
|
|
102
|
+
def shadowing: (Skyward::API::Endpoints::Route route, String verb, Array[String | Symbol] pattern, Array[[ Skyward::API::Endpoints::Route, Skyward::API::Routing::Router::Endpoint ]] built) -> Refusal?
|
|
64
103
|
|
|
65
104
|
# A path parameter matches any segment but an empty one, which only the root path has.
|
|
66
105
|
# @rbs pattern: Array[String | Symbol]
|
|
@@ -76,14 +115,21 @@ module Skyward::API::Assembly::Boot
|
|
|
76
115
|
# @rbs providers: Hash[Symbol, Skyward::API::Routing::Router::Provider]
|
|
77
116
|
# @rbs reader: Skyward::Core::Types::Reader
|
|
78
117
|
# @rbs max_body_size: Integer
|
|
79
|
-
# @rbs return: Skyward::API::Routing::Router::Endpoint |
|
|
80
|
-
def endpoint: (Skyward::API api, Skyward::API::Endpoints::Route route, String verb, Array[String | Symbol] pattern, String label, Hash[Symbol, Skyward::API::Routing::Router::Provider] providers, Skyward::Core::Types::Reader reader, Integer max_body_size) -> (Skyward::API::Routing::Router::Endpoint |
|
|
118
|
+
# @rbs return: Skyward::API::Routing::Router::Endpoint | Refusal
|
|
119
|
+
def endpoint: (Skyward::API api, Skyward::API::Endpoints::Route route, String verb, Array[String | Symbol] pattern, String label, Hash[Symbol, Skyward::API::Routing::Router::Provider] providers, Skyward::Core::Types::Reader reader, Integer max_body_size) -> (Skyward::API::Routing::Router::Endpoint | Refusal)
|
|
81
120
|
|
|
82
121
|
# @rbs klass: Class
|
|
83
|
-
# @rbs
|
|
122
|
+
# @rbs route: Skyward::API::Endpoints::Route
|
|
84
123
|
# @rbs reader: Skyward::Core::Types::Reader
|
|
85
|
-
# @rbs return: RBS::MethodType |
|
|
86
|
-
def method_type: (Class klass,
|
|
124
|
+
# @rbs return: RBS::MethodType | Refusal | nil
|
|
125
|
+
def method_type: (Class klass, Skyward::API::Endpoints::Route route, Skyward::Core::Types::Reader reader) -> (RBS::MethodType | Refusal | nil)
|
|
126
|
+
|
|
127
|
+
# Only the class's own methods, so that a method it inherits, as from
|
|
128
|
+
# Skyward::API or Kernel, is never suggested.
|
|
129
|
+
# @rbs klass: Class
|
|
130
|
+
# @rbs to: Symbol
|
|
131
|
+
# @rbs return: String?
|
|
132
|
+
def unrouted: (Class klass, Symbol to) -> String?
|
|
87
133
|
|
|
88
134
|
# @rbs owner: Module
|
|
89
135
|
# @rbs name: Symbol
|
|
@@ -91,10 +137,10 @@ module Skyward::API::Assembly::Boot
|
|
|
91
137
|
# @rbs return: RBS::MethodType?
|
|
92
138
|
def signature: (Module owner, Symbol name, Skyward::Core::Types::Reader reader) -> RBS::MethodType?
|
|
93
139
|
|
|
94
|
-
# @rbs
|
|
140
|
+
# @rbs method: UnboundMethod
|
|
95
141
|
# @rbs type: RBS::Types::function?
|
|
96
|
-
# @rbs return: Array[[Symbol, bool, RBS::Types::t]] |
|
|
97
|
-
def signed: (
|
|
142
|
+
# @rbs return: Array[[Symbol, bool, RBS::Types::t]] | Refusal
|
|
143
|
+
def signed: (UnboundMethod method, RBS::Types::function? type) -> (Array[[ Symbol, bool, RBS::Types::t ]] | Refusal)
|
|
98
144
|
|
|
99
145
|
# @rbs method_type: RBS::MethodType
|
|
100
146
|
# @rbs return: String
|
|
@@ -106,8 +152,8 @@ module Skyward::API::Assembly::Boot
|
|
|
106
152
|
|
|
107
153
|
# @rbs keywords: Hash[Symbol, bool]
|
|
108
154
|
# @rbs function: RBS::Types::function
|
|
109
|
-
# @rbs return:
|
|
110
|
-
def stale: (Hash[Symbol, bool] keywords, RBS::Types::function function) ->
|
|
155
|
+
# @rbs return: Refusal
|
|
156
|
+
def stale: (Hash[Symbol, bool] keywords, RBS::Types::function function) -> Refusal
|
|
111
157
|
|
|
112
158
|
# @rbs function: RBS::Types::function
|
|
113
159
|
# @rbs return: RBS::Types::Function?
|
|
@@ -117,14 +163,38 @@ module Skyward::API::Assembly::Boot
|
|
|
117
163
|
# @rbs return: Hash[Symbol, bool]
|
|
118
164
|
def keyword_requirements: (RBS::Types::Function function) -> Hash[Symbol, bool]
|
|
119
165
|
|
|
166
|
+
# @rbs route: Skyward::API::Endpoints::Route
|
|
167
|
+
# @rbs method: UnboundMethod
|
|
168
|
+
# @rbs parameter: Symbol
|
|
169
|
+
# @rbs query: Array[Symbol]
|
|
170
|
+
# @rbs return: Refusal
|
|
171
|
+
def no_keyword: (Skyward::API::Endpoints::Route route, UnboundMethod method, Symbol parameter, Array[Symbol] query) -> Refusal
|
|
172
|
+
|
|
173
|
+
# A nested resource's renamed parameter, as `todo_id:` for `/:id`, isn't a
|
|
174
|
+
# misspelling DidYouMean would find, so a keyword that ends in the parameter,
|
|
175
|
+
# or that the parameter ends in, is meant too, when it's the only one.
|
|
176
|
+
# @rbs parameter: Symbol
|
|
177
|
+
# @rbs query: Array[Symbol]
|
|
178
|
+
# @rbs return: Symbol?
|
|
179
|
+
def meant: (Symbol parameter, Array[Symbol] query) -> Symbol?
|
|
180
|
+
|
|
181
|
+
# Core's spot of a parameter list that runs onto another line stops at the end
|
|
182
|
+
# of its first, so only a list written whole on the `def` line is rewritten.
|
|
183
|
+
# @rbs method: UnboundMethod
|
|
184
|
+
# @rbs parameters: Skyward::Core::Diagnostics::Spot
|
|
185
|
+
# @rbs keyword: Skyward::Core::Diagnostics::Spot
|
|
186
|
+
# @rbs parameter: Symbol
|
|
187
|
+
# @rbs return: String?
|
|
188
|
+
def rename_hint: (UnboundMethod method, Skyward::Core::Diagnostics::Spot parameters, Skyward::Core::Diagnostics::Spot keyword, Symbol parameter) -> String?
|
|
189
|
+
|
|
120
190
|
# @rbs name: Symbol
|
|
121
191
|
# @rbs required: bool
|
|
122
192
|
# @rbs type: RBS::Types::t
|
|
123
193
|
# @rbs pattern: Array[String | Symbol]
|
|
124
194
|
# @rbs providers: Hash[Symbol, Skyward::API::Routing::Router::Provider]
|
|
125
195
|
# @rbs reader: Skyward::Core::Types::Reader
|
|
126
|
-
# @rbs return: Skyward::API::Routing::Router::Keyword | Skyward::API::Routing::Router::Provider |
|
|
127
|
-
def keyword: (Symbol name, bool required, RBS::Types::t type, Array[String | Symbol] pattern, Hash[Symbol, Skyward::API::Routing::Router::Provider] providers, Skyward::Core::Types::Reader reader) -> (Skyward::API::Routing::Router::Keyword | Skyward::API::Routing::Router::Provider |
|
|
196
|
+
# @rbs return: Skyward::API::Routing::Router::Keyword | Skyward::API::Routing::Router::Provider | Refusal
|
|
197
|
+
def keyword: (Symbol name, bool required, RBS::Types::t type, Array[String | Symbol] pattern, Hash[Symbol, Skyward::API::Routing::Router::Provider] providers, Skyward::Core::Types::Reader reader) -> (Skyward::API::Routing::Router::Keyword | Skyward::API::Routing::Router::Provider | Refusal)
|
|
128
198
|
|
|
129
199
|
# @rbs name: Symbol
|
|
130
200
|
# @rbs pattern: Array[String | Symbol]
|
|
@@ -133,16 +203,16 @@ module Skyward::API::Assembly::Boot
|
|
|
133
203
|
|
|
134
204
|
# @rbs required: bool
|
|
135
205
|
# @rbs type: RBS::Types::t
|
|
136
|
-
# @rbs return: Skyward::API::Routing::Router::Keyword |
|
|
137
|
-
def request: (bool required, RBS::Types::t type) -> (Skyward::API::Routing::Router::Keyword |
|
|
206
|
+
# @rbs return: Skyward::API::Routing::Router::Keyword | Refusal
|
|
207
|
+
def request: (bool required, RBS::Types::t type) -> (Skyward::API::Routing::Router::Keyword | Refusal)
|
|
138
208
|
|
|
139
209
|
# A provided keyword's type is the provider's to give, so it's compared, never
|
|
140
210
|
# read, except that an untyped keyword is left unchecked, as untyped code is.
|
|
141
211
|
# @rbs name: Symbol
|
|
142
212
|
# @rbs type: RBS::Types::t
|
|
143
213
|
# @rbs provider: Skyward::API::Routing::Router::Provider
|
|
144
|
-
# @rbs return: Skyward::API::Routing::Router::Provider |
|
|
145
|
-
def provided: (Symbol name, RBS::Types::t type, Skyward::API::Routing::Router::Provider provider) -> (Skyward::API::Routing::Router::Provider |
|
|
214
|
+
# @rbs return: Skyward::API::Routing::Router::Provider | Refusal
|
|
215
|
+
def provided: (Symbol name, RBS::Types::t type, Skyward::API::Routing::Router::Provider provider) -> (Skyward::API::Routing::Router::Provider | Refusal)
|
|
146
216
|
|
|
147
217
|
# @rbs type: RBS::Types::t
|
|
148
218
|
# @rbs return: bool
|
|
@@ -157,8 +227,8 @@ module Skyward::API::Assembly::Boot
|
|
|
157
227
|
# @rbs name: Symbol
|
|
158
228
|
# @rbs source: :path | :query | :body | :request
|
|
159
229
|
# @rbs type: Skyward::Core::Types::t
|
|
160
|
-
# @rbs return:
|
|
161
|
-
def carried: (Symbol name, :path | :query | :body | :request source, Skyward::Core::Types::t type) ->
|
|
230
|
+
# @rbs return: Refusal?
|
|
231
|
+
def carried: (Symbol name, :path | :query | :body | :request source, Skyward::Core::Types::t type) -> Refusal?
|
|
162
232
|
|
|
163
233
|
# @rbs type: Skyward::Core::Types::t
|
|
164
234
|
# @rbs within: :path | :query | :array
|
|
@@ -168,8 +238,8 @@ module Skyward::API::Assembly::Boot
|
|
|
168
238
|
# Response values are found in the signature, because the reader can't read them.
|
|
169
239
|
# @rbs type: RBS::Types::t
|
|
170
240
|
# @rbs reader: Skyward::Core::Types::Reader
|
|
171
|
-
# @rbs return: Array[Skyward::API::Routing::Router::returned] |
|
|
172
|
-
def returns: (RBS::Types::t type, Skyward::Core::Types::Reader reader) -> (Array[Skyward::API::Routing::Router::returned] |
|
|
241
|
+
# @rbs return: Array[Skyward::API::Routing::Router::returned] | Refusal
|
|
242
|
+
def returns: (RBS::Types::t type, Skyward::Core::Types::Reader reader) -> (Array[Skyward::API::Routing::Router::returned] | Refusal)
|
|
173
243
|
|
|
174
244
|
# @rbs type: RBS::Types::t
|
|
175
245
|
# @rbs return: Array[RBS::Types::t]
|
|
@@ -208,8 +278,8 @@ module Skyward::API::Assembly::Boot
|
|
|
208
278
|
|
|
209
279
|
# @rbs subject: String
|
|
210
280
|
# @rbs type: Skyward::Core::Types::Unreadable
|
|
211
|
-
# @rbs return:
|
|
212
|
-
def unreadable: (String subject, Skyward::Core::Types::Unreadable type) ->
|
|
281
|
+
# @rbs return: Refusal
|
|
282
|
+
def unreadable: (String subject, Skyward::Core::Types::Unreadable type) -> Refusal
|
|
213
283
|
|
|
214
284
|
# @rbs text: String
|
|
215
285
|
# @rbs return: String
|
|
@@ -14,11 +14,15 @@ module Skyward::API::Endpoints
|
|
|
14
14
|
|
|
15
15
|
attr_reader description(): String?
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
| (verb: Symbol, path: String, to: Symbol, summary: String?, description: String?) -> instance
|
|
17
|
+
attr_reader file(): String?
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
attr_reader line(): Integer?
|
|
21
20
|
|
|
22
|
-
def
|
|
21
|
+
def self.new: (Symbol verb, String path, Symbol to, String? summary, String? description, String? file, Integer? line) -> instance
|
|
22
|
+
| (verb: Symbol, path: String, to: Symbol, summary: String?, description: String?, file: String?, line: Integer?) -> instance
|
|
23
|
+
|
|
24
|
+
def self.members: () -> [ :verb, :path, :to, :summary, :description, :file, :line ]
|
|
25
|
+
|
|
26
|
+
def members: () -> [ :verb, :path, :to, :summary, :description, :file, :line ]
|
|
23
27
|
end
|
|
24
28
|
end
|
|
@@ -57,10 +57,15 @@ module Skyward::API::Inputs::Coercer
|
|
|
57
57
|
# none of them.
|
|
58
58
|
MISFIT: Invalid
|
|
59
59
|
|
|
60
|
-
# INTEGER, DATE and TIME match a String's bytes, because a path
|
|
61
|
-
# can be any bytes, and Regexp#match raises on a String that isn't
|
|
60
|
+
# INTEGER, DECIMAL, DATE and TIME match a String's bytes, because a path
|
|
61
|
+
# parameter can be any bytes, and Regexp#match raises on a String that isn't
|
|
62
|
+
# UTF-8.
|
|
62
63
|
INTEGER: Regexp
|
|
63
64
|
|
|
65
|
+
# No exponent, NaN or Infinity: "1e1000000000" is short, but written without
|
|
66
|
+
# an exponent it's a billion digits long.
|
|
67
|
+
DECIMAL: Regexp
|
|
68
|
+
|
|
64
69
|
BOOLEANS: Hash[String, bool]
|
|
65
70
|
|
|
66
71
|
DATE: Regexp
|
|
@@ -72,6 +77,10 @@ module Skyward::API::Inputs::Coercer
|
|
|
72
77
|
|
|
73
78
|
FORMATS: Hash[Skyward::Core::Types::scalar, String]
|
|
74
79
|
|
|
80
|
+
# A Hash[String, T] says its keys are Strings, so an untyped value it holds
|
|
81
|
+
# keeps the JSON's String keys at every level.
|
|
82
|
+
AS_PARSED: Array[Skyward::Core::Types::t]
|
|
83
|
+
|
|
75
84
|
# Path and query values are Strings, so with strings: true a coercer parses them.
|
|
76
85
|
# @rbs type: Skyward::Core::Types::t
|
|
77
86
|
# @rbs strings: bool
|
|
@@ -122,6 +131,9 @@ module Skyward::API::Inputs::Coercer
|
|
|
122
131
|
# @rbs return: String?
|
|
123
132
|
def last: (String | Array[String] raw) -> String?
|
|
124
133
|
|
|
134
|
+
# @rbs return: coercer
|
|
135
|
+
def as_parsed: () -> coercer
|
|
136
|
+
|
|
125
137
|
# @rbs raw: untyped
|
|
126
138
|
# @rbs return: untyped
|
|
127
139
|
def symbolized: (untyped raw) -> untyped
|
|
@@ -149,6 +161,12 @@ module Skyward::API::Inputs::Coercer
|
|
|
149
161
|
# @rbs return: Ok?
|
|
150
162
|
def time: (untyped raw) -> Ok?
|
|
151
163
|
|
|
164
|
+
# A JSON number isn't one, because JSON.parse has already made it a Float,
|
|
165
|
+
# which may have lost digits.
|
|
166
|
+
# @rbs raw: untyped
|
|
167
|
+
# @rbs return: Ok?
|
|
168
|
+
def decimal: (untyped raw) -> Ok?
|
|
169
|
+
|
|
152
170
|
# @rbs value: Skyward::Core::Types::literal
|
|
153
171
|
# @rbs strings: bool
|
|
154
172
|
# @rbs expected: String?
|
|
@@ -126,9 +126,42 @@ class Skyward::API::Routing::Router
|
|
|
126
126
|
def members: () -> [ :api, :to, :inputs, :params, :serializer ]
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
+
class Target < Data
|
|
130
|
+
attr_reader index(): Integer
|
|
131
|
+
|
|
132
|
+
attr_reader endpoint(): Endpoint
|
|
133
|
+
|
|
134
|
+
attr_reader params(): Array[[ Symbol, Integer ]]
|
|
135
|
+
|
|
136
|
+
def self.new: (Integer index, Endpoint endpoint, Array[[ Symbol, Integer ]] params) -> instance
|
|
137
|
+
| (index: Integer, endpoint: Endpoint, params: Array[[ Symbol, Integer ]]) -> instance
|
|
138
|
+
|
|
139
|
+
def self.members: () -> [ :index, :endpoint, :params ]
|
|
140
|
+
|
|
141
|
+
def members: () -> [ :index, :endpoint, :params ]
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# First is the lowest index in or below the node, so a search can skip a node that can't beat what it has found.
|
|
145
|
+
class Node < Data
|
|
146
|
+
attr_reader literals(): Hash[String, Node]
|
|
147
|
+
|
|
148
|
+
attr_reader param(): Node?
|
|
149
|
+
|
|
150
|
+
attr_reader target(): Target?
|
|
151
|
+
|
|
152
|
+
attr_reader first(): Integer
|
|
153
|
+
|
|
154
|
+
def self.new: (Hash[String, Node] literals, Node? param, Target? target, Integer first) -> instance
|
|
155
|
+
| (literals: Hash[String, Node], param: Node?, target: Target?, first: Integer) -> instance
|
|
156
|
+
|
|
157
|
+
def self.members: () -> [ :literals, :param, :target, :first ]
|
|
158
|
+
|
|
159
|
+
def members: () -> [ :literals, :param, :target, :first ]
|
|
160
|
+
end
|
|
161
|
+
|
|
129
162
|
METHODS: Array[String]
|
|
130
163
|
|
|
131
|
-
@
|
|
164
|
+
@trees: Hash[String, Node]
|
|
132
165
|
|
|
133
166
|
# @rbs endpoints: Array[Endpoint]
|
|
134
167
|
# @rbs return: void
|
|
@@ -145,14 +178,24 @@ class Skyward::API::Routing::Router
|
|
|
145
178
|
|
|
146
179
|
private
|
|
147
180
|
|
|
148
|
-
# @rbs endpoint: Endpoint
|
|
149
|
-
# @rbs verb: String
|
|
150
|
-
# @rbs segments: Array[String]
|
|
151
|
-
# @rbs return: Match?
|
|
152
|
-
def match_endpoint: (Endpoint endpoint, String verb, Array[String] segments) -> Match?
|
|
153
|
-
|
|
154
181
|
# @rbs pattern: Array[String | Symbol]
|
|
182
|
+
# @rbs return: Array[[Symbol, Integer]]
|
|
183
|
+
def params_of: (Array[String | Symbol] pattern) -> Array[[ Symbol, Integer ]]
|
|
184
|
+
|
|
185
|
+
# @rbs targets: Array[Target]
|
|
186
|
+
# @rbs depth: Integer
|
|
187
|
+
# @rbs return: Node
|
|
188
|
+
def build: (Array[Target] targets, Integer depth) -> Node
|
|
189
|
+
|
|
190
|
+
# @rbs node: Node?
|
|
155
191
|
# @rbs segments: Array[String]
|
|
156
|
-
# @rbs
|
|
157
|
-
|
|
192
|
+
# @rbs depth: Integer
|
|
193
|
+
# @rbs best: Target?
|
|
194
|
+
# @rbs return: Target?
|
|
195
|
+
def search: (Node? node, Array[String] segments, Integer depth, Target? best) -> Target?
|
|
196
|
+
|
|
197
|
+
# @rbs target: Target?
|
|
198
|
+
# @rbs best: Target?
|
|
199
|
+
# @rbs return: Target?
|
|
200
|
+
def earlier: (Target? target, Target? best) -> Target?
|
|
158
201
|
end
|
|
@@ -104,6 +104,12 @@ module Skyward::API::Serializer::Writers
|
|
|
104
104
|
# @rbs return: String
|
|
105
105
|
def time: (Time value) -> String
|
|
106
106
|
|
|
107
|
+
# A String, so a client that reads JSON numbers as doubles keeps every digit,
|
|
108
|
+
# and "F" so it never has an exponent.
|
|
109
|
+
# @rbs value: BigDecimal
|
|
110
|
+
# @rbs return: String
|
|
111
|
+
def decimal: (BigDecimal value) -> String
|
|
112
|
+
|
|
107
113
|
# @rbs value: untyped
|
|
108
114
|
# @rbs at: String
|
|
109
115
|
# @rbs return: untyped
|
|
@@ -43,7 +43,7 @@ class Skyward::API::Serializer
|
|
|
43
43
|
# @rbs return: Writers::Writer
|
|
44
44
|
def compile: (Skyward::API::Routing::Router::returned member) -> Writers::Writer
|
|
45
45
|
|
|
46
|
-
# Untyped code can return any response value.
|
|
46
|
+
# Untyped code can return any response value, or a Rack triple.
|
|
47
47
|
# @rbs return: Writers::Writer
|
|
48
48
|
def untyped: () -> Writers::Writer
|
|
49
49
|
|
|
@@ -62,6 +62,18 @@ class Skyward::API::Serializer
|
|
|
62
62
|
# @rbs return: Writers::Writer
|
|
63
63
|
def rack: () -> Writers::Writer
|
|
64
64
|
|
|
65
|
+
# Nothing typed says an untyped value is a triple, so it must have a status HTTP has and a body Rack can send.
|
|
66
|
+
# @rbs return: Writers::Writer
|
|
67
|
+
def untyped_rack: () -> Writers::Writer
|
|
68
|
+
|
|
69
|
+
# @rbs fits: ^(untyped) -> bool
|
|
70
|
+
# @rbs return: Writers::Writer
|
|
71
|
+
def rack_writer: (^(untyped) -> bool fits) -> Writers::Writer
|
|
72
|
+
|
|
73
|
+
# @rbs given: untyped
|
|
74
|
+
# @rbs return: bool
|
|
75
|
+
def triple?: (untyped given) -> bool
|
|
76
|
+
|
|
65
77
|
# @rbs problem: Problem
|
|
66
78
|
# @rbs given: untyped
|
|
67
79
|
# @rbs return: Skyward::API::Assembly::Dispatcher::response
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: skyward-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jake Bottrall
|
|
@@ -15,14 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.4.1
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.4.1
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: bigdecimal
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '3.1'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '3.1'
|
|
26
40
|
- !ruby/object:Gem::Dependency
|
|
27
41
|
name: zeitwerk
|
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -43,6 +57,7 @@ executables: []
|
|
|
43
57
|
extensions: []
|
|
44
58
|
extra_rdoc_files: []
|
|
45
59
|
files:
|
|
60
|
+
- LICENSE
|
|
46
61
|
- README.md
|
|
47
62
|
- lib/skyward/api.rb
|
|
48
63
|
- lib/skyward/api/assembly.rb
|
|
@@ -92,6 +107,7 @@ files:
|
|
|
92
107
|
- lib/skyward/api/test.rb
|
|
93
108
|
- lib/skyward/api/test/client.rb
|
|
94
109
|
- lib/skyward/api/version.rb
|
|
110
|
+
- sig/_private/zeitwerk.rbs
|
|
95
111
|
- sig/generated/skyward/api.rbs
|
|
96
112
|
- sig/generated/skyward/api/assembly.rbs
|
|
97
113
|
- sig/generated/skyward/api/assembly/application.rbs
|
|
@@ -151,7 +167,6 @@ files:
|
|
|
151
167
|
- sig/manual/skyward/api/routing/percent_encoding.rbs
|
|
152
168
|
- sig/manual/skyward/api/serializer/writers.rbs
|
|
153
169
|
- sig/manual/skyward/api/test.rbs
|
|
154
|
-
- sig/manual/zeitwerk/loader.rbs
|
|
155
170
|
homepage: https://github.com/bottrall/skyward
|
|
156
171
|
licenses:
|
|
157
172
|
- MIT
|
|
File without changes
|