Sha256: 03708846e4dd0250266176c95d2116e63c7c51222b05d6f8b17a3b04736228c7

Contents?: true

Size: 1.35 KB

Versions: 18

Compression:

Stored size: 1.35 KB

Contents

require 'reform'
require 'reform/form'

module PactBroker
  module Api
    module Contracts
      class PutPacticipantNameContract < Reform::Form
        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 < Reform::Form
        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)
              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

18 entries across 18 versions & 1 rubygems

Version Path
pact_broker-2.0.2 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.1 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0.beta.8 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0.beta.7 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0.beta.6 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-1.18.0 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0.beta.5 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-1.18.0.beta.1 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-1.17.2 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-1.17.1 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0.beta.4 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0.beta.3 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0.beta.2 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-2.0.0.beta.1 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-1.17.0 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-1.16.0 lib/pact_broker/api/contracts/put_pact_params_contract.rb
pact_broker-1.15.0 lib/pact_broker/api/contracts/put_pact_params_contract.rb