diff --git a/Gemfile b/Gemfile index 188ad31..c0f5920 100644 --- a/Gemfile +++ b/Gemfile @@ -6,8 +6,8 @@ gem "activesupport" gem "rspec" gem "rspec-json_expectations" gem "rspec-sorbet", "~> 1.9.2" -gem "sorbet-coerce", ">= 0.2.6" -gem "sorbet-static-and-runtime", ">= 0.5.11609" +gem "sorbet-coerce", "~> 0.7.0" +gem "sorbet-static-and-runtime", "0.5.11670" gem "tapioca", "~> 0.15.1", require: false gem "syntax_tree", "~> 6.2", require: false diff --git a/Gemfile.lock b/Gemfile.lock index f17f896..9918aaf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,18 +85,18 @@ GEM safe_type (1.1.1) securerandom (0.3.1) shellany (0.0.1) - sorbet (0.5.11609) - sorbet-static (= 0.5.11609) + sorbet (0.5.11670) + sorbet-static (= 0.5.11670) sorbet-coerce (0.7.0) polyfill (~> 1.8) safe_type (~> 1.1, >= 1.1.1) sorbet-runtime (>= 0.4.4704) - sorbet-runtime (0.5.11609) - sorbet-static (0.5.11609-universal-darwin) - sorbet-static (0.5.11609-x86_64-linux) - sorbet-static-and-runtime (0.5.11609) - sorbet (= 0.5.11609) - sorbet-runtime (= 0.5.11609) + sorbet-runtime (0.5.11670) + sorbet-static (0.5.11670-universal-darwin) + sorbet-static (0.5.11670-x86_64-linux) + sorbet-static-and-runtime (0.5.11670) + sorbet (= 0.5.11670) + sorbet-runtime (= 0.5.11670) spoom (1.4.2) erubi (>= 1.10.0) prism (>= 0.28.0) @@ -132,8 +132,8 @@ DEPENDENCIES rspec rspec-json_expectations rspec-sorbet (~> 1.9.2) - sorbet-coerce (>= 0.2.6) - sorbet-static-and-runtime (>= 0.5.11609) + sorbet-coerce (~> 0.7.0) + sorbet-static-and-runtime (= 0.5.11670) syntax_tree (~> 6.2) tapioca (~> 0.15.1) diff --git a/lib/resource_registry.rb b/lib/resource_registry.rb index 54132e7..f34487b 100644 --- a/lib/resource_registry.rb +++ b/lib/resource_registry.rb @@ -8,12 +8,15 @@ require "public/versions" require "public/versions/version" require "public/entity_finder" +require "public/resource_struct_builder" +require "public/registry" +require "public/serializer" +require "public/repositories/base" +require "schema_registry/registry" require "schema_registry/json_schema_mapper" require "schema_registry/maybe" require "schema_registry/generate_from_struct" require "runtime_generic" -require "public/resource_struct_builder" -require "public/registry" # Entry point for ResourceRegistry module ResourceRegistry diff --git a/lib/schema_generator.rb b/lib/schema_generator.rb deleted file mode 100644 index e12cbc2..0000000 --- a/lib/schema_generator.rb +++ /dev/null @@ -1,34 +0,0 @@ -# typed: strict - -require_relative "./schema_registry/generate_from_struct" - -module ResourceRegistry - class SchemaGenerator - extend T::Sig - - Repository = - T.type_alias { T.class_of(ResourceRegistry::Repositories::Base) } - - sig do - params(repository: Repository).returns(T.nilable(SchemaRegistry::Schema)) - end - def generate(repository:) - struct_klass = ResourceRegistry::EntityFinder.call(repository: repository) - return nil unless struct_klass - - definition = - SchemaRegistry::GenerateFromStruct.new(struct_klass: struct_klass).call - SchemaRegistry::JsonSchemaMapper.new( - namespace: repository.namespace, - definition: definition - ).call - end - - private - - sig { params(repo: Repository).returns(Symbol) } - def identifier_from_repo(repo) - "#{repo.namespace.underscore}.#{T.must(repo.name).underscore.singularize}".to_sym - end - end -end diff --git a/resource_registry-0.0.0.gem b/resource_registry-0.0.0.gem new file mode 100644 index 0000000..4af2741 Binary files /dev/null and b/resource_registry-0.0.0.gem differ diff --git a/resource_registry.gemspec b/resource_registry.gemspec index 5d24fa9..6887956 100644 --- a/resource_registry.gemspec +++ b/resource_registry.gemspec @@ -1,19 +1,24 @@ Gem::Specification.new do |s| - s.name = 'resource_registry' - s.version = '0.0.0' - s.summary = 'Resource Registry' - s.description = 'A declarative approach to define resources and their relationships' - s.authors = ['Genar Trias Ortiz'] - s.email = 'genar.factorial@factorial.co' - s.files = ['lib/resource_registry.rb', 'lib/public/repositories/base.rb', 'rbi/resource_registry.rbi'] - s.homepage = - 'https://rubygems.org/gems/resource_registry' - s.license = 'MIT' - s.add_dependency 'sorbet-coerce', '>= 0.2.6' + s.name = "resource_registry" + s.version = "0.0.0" + s.summary = "Resource Registry" + s.description = + "A declarative approach to define resources and their relationships" + s.authors = ["Genar Trias Ortiz"] + s.email = "genar.factorial@factorial.co" + s.files = %w[ + lib/resource_registry.rb + lib/public/repositories/base.rb + rbi/resource_registry.rbi + ] + s.homepage = "https://rubygems.org/gems/resource_registry" + s.license = "MIT" + s.required_ruby_version = ">= 3.0" + s.add_dependency "sorbet-coerce", "~> 0.2.6" # s.add_runtime_dependency 'sorbet-runtime-stub', '0.2.0' - s.add_development_dependency 'sorbet', '0.5.11609' - s.add_runtime_dependency 'activesupport', '>= 7.1.3' - s.add_runtime_dependency 'dry-inflector', '>= 0.1.2' - s.add_runtime_dependency 'sorbet-runtime', '0.5.11609' + s.add_development_dependency "sorbet", "0.5.11670" + s.add_runtime_dependency "activesupport", "~> 7.1.3" + s.add_runtime_dependency "dry-inflector", "~> 0.1.2" + s.add_runtime_dependency "sorbet-runtime", "0.5.11609" # s.add_development_dependency 'tapioca' end