Skip to content

How to validate dependent parameters  #1231

Closed
@brahamshakti

Description

@brahamshakti

In you documentation you said that dependent parameter can be validated using

params do
    optional :shelf_id, type: Integer
    given :shelf_id do
        requires :bin_id, type: Integer
    end
end

but how can i perform validation on basis of two fields like

params do
    optional :first_name, type: String
    optional :last_name, type: String
    given :first_name, :last_name do
        requires :ssn, type: String
    end
end

Is it possible to do that I tried it but swagger is not validating ssn.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions