Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API v2] Date time does not validate properly if the timezone is used #16

Closed
initvector opened this issue Aug 21, 2017 · 2 comments
Closed

Comments

@initvector
Copy link
Contributor

@DaazKu commented on Mon Aug 14 2017

Calling http://vanilla.dev/api/v2/comments?discussionid=30 yields:

[
    {
        "commentID": 7,
        "discussionID": 30,
        "body": "<p>comment 1</p>\n",
        "format": "Markdown",
        "dateInserted": "2017-07-27T19:26:24+00:00",
        "insertUserID": 2,
        "url": "http://vanilla.dev/discussion/comment/7#Comment_7"
    },
    {
        "commentID": 8,
        "discussionID": 30,
        "body": "<p>comment 2</p>\n",
        "format": "Markdown",
        "dateInserted": "2017-07-27T19:26:28+00:00",
        "insertUserID": 2,
        "url": "http://vanilla.dev/discussion/comment/8#Comment_8"
    },
    {
        "commentID": 9,
        "discussionID": 30,
        "body": "<p>comment 3</p>\n",
        "format": "Markdown",
        "dateInserted": "2017-07-27T19:26:33+00:00",
        "insertUserID": 2,
        "url": "http://vanilla.dev/discussion/comment/9#Comment_9"
    },
    {
        "commentID": 12,
        "discussionID": 30,
        "body": "<p>asd</p>\n",
        "format": "Markdown",
        "dateInserted": "2017-08-14T14:42:58+00:00",
        "insertUserID": 2,
        "url": "http://vanilla.dev/discussion/comment/12#Comment_12"
    }
]

You get an error using the dateInserted field as the after parameter like so http://vanilla.dev/api/v2/comments?discussionid=30&after=2017-07-27T19:26:24+00:00

{
    "message": "after is not a valid datetime.",
    "status": 422,
    "errors": [
        {
            "field": "after",
            "code": "invalid",
            "message": "after is not a valid datetime."
        }
    ]
}

This is counter intuitive because the return type of dateInserted is DateTime... It should work properly

@tburry
Copy link
Contributor

tburry commented Aug 22, 2017

This is a URL encoding issue. The "+" gets encoded as a space. I am unsure if I want to provide a workaround for this in garden-schema.

@DaazKu
Copy link
Contributor

DaazKu commented Aug 22, 2017

I would definitely not do it in the schema.

@tburry tburry closed this as completed Aug 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants