Sha256: 4de06cfecc4688c0ddd1f20b1ae7f133bb399cfb013ea57c3231c35aed49021d

Contents?: true

Size: 1.26 KB

Versions: 32

Compression:

Stored size: 1.26 KB

Contents

require "dry-validation"
require "pact_broker/api/contracts/dry_validation_workarounds"
require "pact_broker/api/contracts/dry_validation_predicates"

module PactBroker
  module Api
    module Contracts
      class PactsForVerificationQueryStringSchema
        extend DryValidationWorkarounds
        using PactBroker::HashRefinements

        SCHEMA = Dry::Validation.Schema do
          configure do
            predicates(DryValidationPredicates)
            config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__)
          end
          optional(:provider_version_tags).maybe(:array?)
          optional(:consumer_version_selectors).each do
            schema do
              required(:tag).filled(:str?)
              optional(:latest).filled(included_in?: ["true", "false"])
              optional(:fallback_tag).filled(:str?)
              optional(:consumer).filled(:str?, :not_blank?)
            end
          end
          optional(:include_pending_status).filled(included_in?: ["true", "false"])
          optional(:include_wip_pacts_since).filled(:date?)
        end

        def self.call(params)
          select_first_message(flatten_indexed_messages(SCHEMA.call(params&.symbolize_keys).messages(full: true)))
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
pact_broker-2.106.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.105.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.104.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.103.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.102.2 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.102.1 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.102.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.101.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.100.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.99.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.98.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.97.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.96.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.95.1 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.95.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.94.0 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.93.4 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.93.3 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.93.2 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb
pact_broker-2.93.1 lib/pact_broker/api/contracts/pacts_for_verification_query_string_schema.rb