Sha256: 70468cc62b9d0191714c49e3857c970e9913500077a0e7026c78db1dfdaa33dd

Contents?: true

Size: 840 Bytes

Versions: 26

Compression:

Stored size: 840 Bytes

Contents

module Foobara
  module TypeDeclarations
    module Handlers
      class ExtendEntityTypeDeclaration < ExtendModelTypeDeclaration
        class ValidatePrimaryKeyPresent < TypeDeclarations::TypeDeclarationValidator
          # TODO: seems like maybe we could actually check against types now...
          # like make a type for primary_key: :symbol ??
          class MissingPrimaryKeyError < TypeDeclarationError; end

          def validation_errors(strict_type_declaration)
            unless strict_type_declaration.key?(:primary_key)
              build_error
            end
          end

          def error_message(_value)
            "Missing required :primary_key to state which attribute is the primary key"
          end

          def error_context(_value)
            {}
          end
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foobara-0.0.26 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.25 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.24 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.23 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.22 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.21 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.20 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.19 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.18 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.17 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.16 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.15 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.14 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.13 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.12 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.11 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.10 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.9 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.8 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.7 projects/entity/src/extensions/type_declarations/handlers/extend_entity_type_declaration/validate_primary_key_present.rb