Sha256: e69f1d939716f662ee010baa17320ef5a5f8b9dae7783aa7b0eab21bb99a17e1

Contents?: true

Size: 1.43 KB

Versions: 36

Compression:

Stored size: 1.43 KB

Contents

require "pact_broker/api/contracts/base_contract"

module PactBroker
  module Api
    module Contracts
      class PutPacticipantNameContract < BaseContract
        property :name
        property :name_in_pact
        property :pacticipant
        property :message_args

        validation do
          configure do
            config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__)
          end

          required(:name).maybe
          required(:name_in_pact).maybe

          rule(name_in_path_matches_name_in_pact?: [:name, :name_in_pact]) do |name, name_in_pact|
            name_in_pact.filled?.then(name.eql?(value(:name_in_pact)))
          end
        end
      end

      class PutPactParamsContract < BaseContract
        property :consumer_version_number
        property :consumer, form: PutPacticipantNameContract
        property :provider, form: PutPacticipantNameContract

        validation do
          configure do
            config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__)

            def valid_consumer_version_number?(value)
              return true if PactBroker.configuration.order_versions_by_date
              parsed_version_number = PactBroker.configuration.version_parser.call(value)
              !parsed_version_number.nil?
            end
          end

          required(:consumer_version_number).filled(:valid_consumer_version_number?)
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

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