Skip to content

Optional parameter with a message attribute exception #2517

@ericproulx

Description

@ericproulx

It probably never happened but defining a optional parameter with a message attribute will raise an exception.

The following test will fail.

context 'optional param with message' do
  let(:app) do
    Class.new(described_class) do
      params do
        optional 'test', message: 'is required'
      end
      get 'test'
    end
  end

  before do

  end

  it 'should return a message' do
    expect { get 'test' }.not_to raise_error
  end
end

It's an easy fix where we need to remove the message key even if presence is not required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions