camille 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/camille/basic_type.rb +2 -0
- data/lib/camille/{controller_extension.rb → controller.rb} +1 -1
- data/lib/camille/endpoint.rb +1 -3
- data/lib/camille/railtie.rb +2 -2
- data/lib/camille/types/boolean_literal.rb +27 -0
- data/lib/camille/types/string.rb +1 -1
- data/lib/camille/version.rb +1 -1
- data/lib/camille.rb +2 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f58d6bc69ec0ca18561254ccd7a8cb48caf134bca3b65b3694e09eda2d480c86
|
4
|
+
data.tar.gz: cf6a91b9ed549c095ec5b911e20fc92ea43c64b0634e3eaf9da8ebec29f7da24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ecfa0f3d4753d480e70967c1da84a9442121226d942c81bb24398ebeef2520148efd4d14b702532f69148dc50a5d70e35ff3de418df6df99077f96573754281
|
7
|
+
data.tar.gz: 0a39893452ae9461b50919c1cfa5a20cc29bf4b0e6c46b3bfd873128d71ff0b5329875755319104dbd071722941b935b2366476378b7d60238ddde990d01fa1c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.5.3
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
* Added boolean literal types
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
* Renamed `Camille::ControllerExtension` to `Camille::Controller`
|
12
|
+
|
13
|
+
## 0.5.2
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
* Symbols are now accepted in string types
|
18
|
+
* When omitted, the response type of an endpoint will now have the default `{}`
|
19
|
+
|
3
20
|
## 0.5.1
|
4
21
|
|
5
22
|
### Fixed
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/camille/basic_type.rb
CHANGED
@@ -42,6 +42,8 @@ module Camille
|
|
42
42
|
Camille::Types::NumberLiteral.new(value)
|
43
43
|
when value.is_a?(::String)
|
44
44
|
Camille::Types::StringLiteral.new(value)
|
45
|
+
when value == true || value == false
|
46
|
+
Camille::Types::BooleanLiteral.new(value)
|
45
47
|
when value.is_a?(Camille::BasicType)
|
46
48
|
value
|
47
49
|
when value.is_a?(Class) && value < Camille::BasicType && value.directly_instantiable?
|
data/lib/camille/endpoint.rb
CHANGED
@@ -12,9 +12,7 @@ module Camille
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def signature
|
15
|
-
|
16
|
-
raise UnknownResponseError.new("Endpoint lacking a `response` definition.")
|
17
|
-
end
|
15
|
+
@response_type ||= Camille::Types::Object.new({})
|
18
16
|
if @params_type
|
19
17
|
"#{ActiveSupport::Inflector.camelize @name, false}(params: #{@params_type.literal}): Promise<#{@response_type.literal}>"
|
20
18
|
else
|
data/lib/camille/railtie.rb
CHANGED
@@ -4,8 +4,8 @@ module Camille
|
|
4
4
|
class Railtie < ::Rails::Railtie
|
5
5
|
|
6
6
|
initializer "camille.configure_rails" do |app|
|
7
|
-
ActionController::API.include(Camille::
|
8
|
-
ActionController::Base.include(Camille::
|
7
|
+
ActionController::API.include(Camille::Controller)
|
8
|
+
ActionController::Base.include(Camille::Controller)
|
9
9
|
|
10
10
|
Camille::Loader.setup_zeitwerk_loader(app)
|
11
11
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Camille
|
2
|
+
module Types
|
3
|
+
class BooleanLiteral < Camille::BasicType
|
4
|
+
class ArgumentError < ::ArgumentError; end
|
5
|
+
|
6
|
+
attr_reader :value
|
7
|
+
|
8
|
+
def initialize value
|
9
|
+
if value == true || value == false
|
10
|
+
@value = value
|
11
|
+
else
|
12
|
+
raise ArgumentError.new("Expecting true or false, got #{value.inspect}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def check value
|
17
|
+
unless value == @value
|
18
|
+
Camille::TypeError.new("Expected boolean literal #{@value.inspect}, got #{value.inspect}.")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def literal
|
23
|
+
@value.to_s
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/camille/types/string.rb
CHANGED
data/lib/camille/version.rb
CHANGED
data/lib/camille.rb
CHANGED
@@ -17,6 +17,7 @@ require_relative "camille/types/tuple"
|
|
17
17
|
require_relative "camille/types/any"
|
18
18
|
require_relative "camille/types/number_literal"
|
19
19
|
require_relative "camille/types/string_literal"
|
20
|
+
require_relative "camille/types/boolean_literal"
|
20
21
|
require_relative "camille/pick_and_omit"
|
21
22
|
require_relative "camille/types/pick"
|
22
23
|
require_relative "camille/types/omit"
|
@@ -29,7 +30,7 @@ require_relative "camille/schema"
|
|
29
30
|
require_relative "camille/schemas"
|
30
31
|
require_relative "camille/line"
|
31
32
|
require_relative "camille/railtie"
|
32
|
-
require_relative "camille/
|
33
|
+
require_relative "camille/controller"
|
33
34
|
require_relative "camille/loader"
|
34
35
|
require_relative "camille/configuration"
|
35
36
|
require_relative "camille/code_generator"
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 辻彩
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -51,7 +51,7 @@ files:
|
|
51
51
|
- lib/camille/basic_type.rb
|
52
52
|
- lib/camille/code_generator.rb
|
53
53
|
- lib/camille/configuration.rb
|
54
|
-
- lib/camille/
|
54
|
+
- lib/camille/controller.rb
|
55
55
|
- lib/camille/endpoint.rb
|
56
56
|
- lib/camille/generators/install_generator.rb
|
57
57
|
- lib/camille/generators/schema_generator.rb
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/camille/types/any.rb
|
78
78
|
- lib/camille/types/array.rb
|
79
79
|
- lib/camille/types/boolean.rb
|
80
|
+
- lib/camille/types/boolean_literal.rb
|
80
81
|
- lib/camille/types/null.rb
|
81
82
|
- lib/camille/types/number.rb
|
82
83
|
- lib/camille/types/number_literal.rb
|