Sha256: 246a4671636bc64aa0ba8b9d2af2bad4b6fe06dac9c4e132aa2eefa5a518734b
Contents?: true
Size: 1.23 KB
Versions: 36
Compression:
Stored size: 1.23 KB
Contents
require "dry-validation" require "pact_broker/api/contracts/dry_validation_workarounds" require "pact_broker/api/contracts/dry_validation_predicates" require "pact_broker/messages" module PactBroker module Api module Contracts class PacticipantSchema extend DryValidationWorkarounds extend PactBroker::Messages using PactBroker::HashRefinements SCHEMA = Dry::Validation.Schema do configure do predicates(DryValidationPredicates) config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__) end optional(:name).filled(:str?, :single_line?) optional(:displayName).maybe(:str?, :single_line?, :not_blank?) optional(:mainBranch).maybe(:str?, :single_line?, :no_spaces?) optional(:repositoryUrl).maybe(:str?, :single_line?) optional(:repositoryName).maybe(:str?, :single_line?) optional(:repositoryNamespace).maybe(:str?, :single_line?) end def self.call(params_with_string_keys) params = params_with_string_keys&.symbolize_keys select_first_message(flatten_indexed_messages(SCHEMA.call(params).messages(full: true))) end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems