Sha256: 8b68481b6868b0534276a37275fbf502f36c9486e78ade676af50fe40733c251

Contents?: true

Size: 848 Bytes

Versions: 8

Compression:

Stored size: 848 Bytes

Contents

module Foobara
  module TypeDeclarations
    module Handlers
      class ExtendDetachedEntityTypeDeclaration < 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

8 entries across 8 versions & 1 rubygems

Version Path
foobara-0.0.38 projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.37 projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.36 projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.35 projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.34 projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.33 projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.32 projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/validate_primary_key_present.rb
foobara-0.0.31 projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/validate_primary_key_present.rb