interagent / interagent/committee

string with format: date not working

Open
#260 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Ruby
Stars
955
Forks
145
Avg merge
5d 4h
Merged PRs (30d)
6

Description

Hi,

I'm trying to validate requests using request validation middleware. In one of my API, I'm using following rule for one of my query params in API.

{
            "name" : "from_date",
            "in" : "query",
            "schema" : {
              "type" : "string",
              "format" : "date",
              "example" : "2017-09-24"
            }
 }

As per, this rule request should fail if passed value is not a valid date but it's not failing if I pass from_date=abc.

If I update format to date-time and then if I pass from_date=abc then it's giving me error as expected.

Request should fail if format is date and I pass from_date=abc.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the request validation middleware and the schema format handling for query parameters. Reproduce the issue with the provided schema using from_date=abc, then compare the date and date-time paths. Done means an invalid value for format date is rejected with a validation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.