typelizer 0.1.3 → 0.1.5

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: 883dbe72ef62317bf7561ca3bc91fde04264c479433b8b8db93e04533a34e017
4
- data.tar.gz: 72ce93cdf283d81378278a465ac20627b0e5a89237246c953039cfe3aab9f7aa
3
+ metadata.gz: 52c5a98a49d5f7a6f040da23ce1ff5c7b8453a758c0daae251788189be0fc874
4
+ data.tar.gz: f0b023ec773a121a30d5ee587118dad4c30b36f33309e34e4d07fb77b32a93fd
5
5
  SHA512:
6
- metadata.gz: 35ea6330569e25236a7a77a89d86558eb260c24fc93ca21f2c07191a299e47bc5798c86fda6a0c1c82ac1c1f8ef00eafb2007962fa2219a724d31e2653cb686a
7
- data.tar.gz: dbdf51e50c2f327e31785be7f3e60f2b016136b7ca9fb282be3e63935f96b6217758a308e305bb4e75d4a58bc5d41d330df26cd27a2eb514fd920295f5a2f151
6
+ metadata.gz: 6c4b5d39763829b212109356ac5f81967cbcd2340562bddf6bb116cd98d18e209e42f0d694d7fdb62241c661849591e75728250eb856929b68cdbdb4d54fd03a
7
+ data.tar.gz: 66635cbafdbc3babb70f92dd2a73b924954f7e7b3f22623397ef53c99d62f8c62c3daea754634833dd3909cdaaa4e03f6aa114c1d7156202aa8274ee2a77cc2e
data/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning].
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.5] - 2024-10-07
11
+
12
+ ## Fixed
13
+
14
+ - Fix the duplicated import with multiple same association ([@okuramasafumi])
15
+
16
+ ## [0.1.4] - 2024-10-04
17
+
18
+ ## Added
19
+
20
+ - PORO model plugin ([@okuramasafumi])
21
+ - Auto model plugin ([@skryukov])
22
+
10
23
  ## [0.1.3] - 2024-09-27
11
24
 
12
25
  ## Added
@@ -48,7 +61,9 @@ and this project adheres to [Semantic Versioning].
48
61
  [@okuramasafumi]: https://github.com/@okuramasafumi
49
62
  [@skryukov]: https://github.com/skryukov
50
63
 
51
- [Unreleased]: https://github.com/skryukov/typelizer/compare/v0.1.3...HEAD
64
+ [Unreleased]: https://github.com/skryukov/typelizer/compare/v0.1.5...HEAD
65
+ [0.1.5]: https://github.com/skryukov/typelizer/compare/v0.1.4...v0.1.5
66
+ [0.1.4]: https://github.com/skryukov/typelizer/compare/v0.1.3...v0.1.4
52
67
  [0.1.3]: https://github.com/skryukov/typelizer/compare/v0.1.2...v0.1.3
53
68
  [0.1.2]: https://github.com/skryukov/typelizer/compare/v0.1.1...v0.1.2
54
69
  [0.1.1]: https://github.com/skryukov/typelizer/compare/v0.1.0...v0.1.1
data/README.md CHANGED
@@ -202,8 +202,8 @@ Typelizer.configure do |config|
202
202
  # Custom transformation for generated properties
203
203
  config.properties_transformer = ->(properties) { ... }
204
204
 
205
- # Plugin for model type inference (default: ModelPlugins::ActiveRecord)
206
- config.model_plugin = Typelizer::ModelPlugins::ActiveRecord
205
+ # Plugin for model type inference (default: ModelPlugins::Auto)
206
+ config.model_plugin = Typelizer::ModelPlugins::Auto
207
207
 
208
208
  # Plugin for serializer parsing (default: SerializerPlugins::Auto)
209
209
  config.serializer_plugin = Typelizer::SerializerPlugins::Auto
@@ -39,7 +39,7 @@ module Typelizer
39
39
  Object.const_get(base_class) if Object.const_defined?(base_class)
40
40
  end,
41
41
 
42
- model_plugin: ModelPlugins::ActiveRecord,
42
+ model_plugin: ModelPlugins::Auto,
43
43
  serializer_plugin: SerializerPlugins::Auto,
44
44
  plugin_configs: {},
45
45
 
@@ -66,7 +66,7 @@ module Typelizer
66
66
  .uniq
67
67
  .reject { |type| global_type?(type) }
68
68
 
69
- custom_type_imports + serializer_types
69
+ (custom_type_imports + serializer_types).uniq
70
70
  end
71
71
 
72
72
  def inspect
@@ -0,0 +1,19 @@
1
+ module Typelizer
2
+ module ModelPlugins
3
+ module Auto
4
+ class << self
5
+ def new(model_class:, config:)
6
+ plugin(model_class).new(model_class: model_class, config: config)
7
+ end
8
+
9
+ def plugin(model_class)
10
+ if model_class && model_class < ::ActiveRecord::Base
11
+ ActiveRecord
12
+ else
13
+ Poro
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ module Typelizer
2
+ module ModelPlugins
3
+ class Poro
4
+ # We don't care about intialization
5
+ def initialize(...)
6
+ end
7
+
8
+ def infer_types(prop)
9
+ prop
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Typelizer
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
data/lib/typelizer.rb CHANGED
@@ -16,6 +16,8 @@ require_relative "typelizer/serializer_plugins/alba"
16
16
  require_relative "typelizer/serializer_plugins/ams"
17
17
 
18
18
  require_relative "typelizer/model_plugins/active_record"
19
+ require_relative "typelizer/model_plugins/poro"
20
+ require_relative "typelizer/model_plugins/auto"
19
21
 
20
22
  require_relative "typelizer/railtie" if defined?(Rails)
21
23
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typelizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-27 00:00:00.000000000 Z
11
+ date: 2024-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -41,6 +41,8 @@ files:
41
41
  - lib/typelizer/interface.rb
42
42
  - lib/typelizer/listen.rb
43
43
  - lib/typelizer/model_plugins/active_record.rb
44
+ - lib/typelizer/model_plugins/auto.rb
45
+ - lib/typelizer/model_plugins/poro.rb
44
46
  - lib/typelizer/property.rb
45
47
  - lib/typelizer/railtie.rb
46
48
  - lib/typelizer/renderer.rb