camille 0.5.15 → 0.5.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/camille/configuration.rb +2 -2
- data/lib/camille/controller.rb +0 -3
- data/lib/camille/endpoint.rb +2 -2
- data/lib/camille/key_converter.rb +1 -1
- data/lib/camille/object_hash.rb +7 -0
- data/lib/camille/pick_and_omit.rb +1 -1
- data/lib/camille/schemas.rb +2 -2
- data/lib/camille/types/object.rb +2 -2
- data/lib/camille/version.rb +1 -1
- data/lib/camille.rb +1 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c64a49ba269a9488e2990dce715d59e21ec603bb09453bc07b48f1b29cf80183
|
4
|
+
data.tar.gz: 482a7672c68154b5ab94c68318b2672f02f76793ad08372570a1b5ec4049e7b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ba48e7bc89d06d8ad92eb375cac5d02d783fc35c5732215f068630b57918a5b0bfaccc89b76d49983b384fbac31e2bbbe208d14526ea37489864e2cb2cee67
|
7
|
+
data.tar.gz: cb52ae9bdfc4445c098040b576d1e6910da8b699a615bfea339ed2bf24b0b180408d67a53b03a1c6259aadf3bda9f407d25c5fc17a12fbd22fb42c0aa0b20637
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -6,8 +6,8 @@ module Camille
|
|
6
6
|
attr_accessor :ts_header, :ts_location
|
7
7
|
|
8
8
|
def load_default_configurations
|
9
|
-
self.response_key_converter = lambda do |
|
10
|
-
|
9
|
+
self.response_key_converter = lambda do |string|
|
10
|
+
string.camelize(:lower)
|
11
11
|
end
|
12
12
|
|
13
13
|
self.params_key_converter = lambda do |string|
|
data/lib/camille/controller.rb
CHANGED
@@ -25,9 +25,6 @@ module Camille
|
|
25
25
|
Camille::TypeErrorPrinter.new(error).print(string_io)
|
26
26
|
raise TypeError.new("\nType check failed for response.\n#{string_io.string}")
|
27
27
|
else
|
28
|
-
if transformed.is_a? Hash
|
29
|
-
transformed.deep_transform_keys!{|k| Camille::KeyConverter.convert_response_key(k)}
|
30
|
-
end
|
31
28
|
super(json: transformed)
|
32
29
|
end
|
33
30
|
else
|
data/lib/camille/endpoint.rb
CHANGED
@@ -16,9 +16,9 @@ module Camille
|
|
16
16
|
raise UnknownResponseError.new("Endpoint lacking a `response` definition.")
|
17
17
|
end
|
18
18
|
if @params_type
|
19
|
-
"#{Camille::Configuration.response_key_converter.call(@name)}(params: #{@params_type.literal}): Promise<#{@response_type.literal}>"
|
19
|
+
"#{Camille::Configuration.response_key_converter.call(@name.to_s)}(params: #{@params_type.literal}): Promise<#{@response_type.literal}>"
|
20
20
|
else
|
21
|
-
"#{Camille::Configuration.response_key_converter.call(@name)}(): Promise<#{@response_type.literal}>"
|
21
|
+
"#{Camille::Configuration.response_key_converter.call(@name.to_s)}(): Promise<#{@response_type.literal}>"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
data/lib/camille/schemas.rb
CHANGED
@@ -31,13 +31,13 @@ module Camille
|
|
31
31
|
tree.map do |key, value|
|
32
32
|
if value.is_a? ::Hash
|
33
33
|
[
|
34
|
-
Camille::Line.new("#{Camille::Configuration.response_key_converter.call(key)}: {"),
|
34
|
+
Camille::Line.new("#{Camille::Configuration.response_key_converter.call(key.to_s)}: {"),
|
35
35
|
tree_literal_lines(value).map(&:do_indent),
|
36
36
|
Camille::Line.new('},')
|
37
37
|
]
|
38
38
|
else
|
39
39
|
value.literal_lines.tap do |lines|
|
40
|
-
lines.first.prepend("#{Camille::Configuration.response_key_converter.call(key)}: ")
|
40
|
+
lines.first.prepend("#{Camille::Configuration.response_key_converter.call(key.to_s)}: ")
|
41
41
|
lines.last.append(',')
|
42
42
|
end
|
43
43
|
end
|
data/lib/camille/types/object.rb
CHANGED
@@ -32,7 +32,7 @@ module Camille
|
|
32
32
|
transformed = transform_and_check_results.map do |key, (error, transformed)|
|
33
33
|
[key, transformed]
|
34
34
|
end.to_h
|
35
|
-
[nil, transformed]
|
35
|
+
[nil, Camille::ObjectHash[transformed]]
|
36
36
|
else
|
37
37
|
[Camille::TypeError.new(**errors.to_h), nil]
|
38
38
|
end
|
@@ -65,7 +65,7 @@ module Camille
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def literal_key key
|
68
|
-
"#{Camille::Configuration.response_key_converter.call(key)}#{@optional_keys.include?(key) ? '?' : ''}"
|
68
|
+
"#{Camille::Configuration.response_key_converter.call(key.to_s)}#{@optional_keys.include?(key) ? '?' : ''}"
|
69
69
|
end
|
70
70
|
|
71
71
|
def check_key_conversion_safe sym
|
data/lib/camille/version.rb
CHANGED
data/lib/camille.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camille
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alyssa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/camille/line.rb
|
68
68
|
- lib/camille/loader.rb
|
69
69
|
- lib/camille/main_controller.rb
|
70
|
+
- lib/camille/object_hash.rb
|
70
71
|
- lib/camille/pick_and_omit.rb
|
71
72
|
- lib/camille/railtie.rb
|
72
73
|
- lib/camille/schema.rb
|
@@ -100,7 +101,7 @@ licenses:
|
|
100
101
|
metadata:
|
101
102
|
homepage_uri: https://github.com/onyxblade/camille
|
102
103
|
source_code_uri: https://github.com/onyxblade/camille
|
103
|
-
post_install_message:
|
104
|
+
post_install_message:
|
104
105
|
rdoc_options: []
|
105
106
|
require_paths:
|
106
107
|
- lib
|
@@ -115,8 +116,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
116
|
- !ruby/object:Gem::Version
|
116
117
|
version: '0'
|
117
118
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
119
|
-
signing_key:
|
119
|
+
rubygems_version: 3.5.22
|
120
|
+
signing_key:
|
120
121
|
specification_version: 4
|
121
122
|
summary: Typed API schema for Rails with TypeScript codegen
|
122
123
|
test_files: []
|