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

Should we make querystrings reserved words? #1004

Open
gabisurita opened this issue Dec 23, 2016 · 3 comments
Open

Should we make querystrings reserved words? #1004

gabisurita opened this issue Dec 23, 2016 · 3 comments
Labels
protocol question stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.

Comments

@gabisurita
Copy link
Member

gabisurita commented Dec 23, 2016

I think maybe we shouldn't to keep a simple schema, but we should do a big warning about this in the docs. We can do some crazy things with them:

$ echo '{"data": {"_limit": 5}}' | http put localhost:8888/v1
{
    "data": {
        "_limit": 5,
        "id": "b1",
        "last_modified": 1482506056818
    },
    "permissions": {
        "write": [
            "basicauth:902db65276f24f6f084cd57fddb1bb3835054d27858a606f59410e8c227465e2"
        ]
    }
}

$ http get localhost:8888/v1/buckets?_limit=1 -a a:a
{
    "data": [
        {
            "_limit": 5,
            "id": "b1",
            "last_modified": 1482506056818
        }
    ]
}
$ echo '{"data": {"min_field": "10", "field": 5}}' | http put localhost:8888/v1/buckets/b1 -a a:a
{
    "data": {
        "field": 5,
        "id": "b1",
        "last_modified": 1482505784675,
        "min_field": 10
    },
    "permissions": {
        "write": [
            "basicauth:902db65276f24f6f084cd57fddb1bb3835054d27858a606f59410e8c227465e2"
        ]
    }
}

$ http get localhost:8888/v1/buckets?min_field=10 -a a:a
{
    "data": []
}
@leplatrem
Copy link
Contributor

:)

Indeed... I wouldn't be against raising a 400 when a record uses a reserved word, but that may be a bit radical I don't know!

@gabisurita
Copy link
Member Author

Maybe we could send just a warning. Can we use the Alert header for this?

@Natim
Copy link
Member

Natim commented Dec 26, 2016

I like your suggestion about the Alert header because we don't break any API.
However I am not against raising a 400 because the API starts to be broken with an undefined behavior as soon as people start to use _sort and _limit in their records.

@alexcottner alexcottner added the stale For marking issues as stale. Labeled issues will be closed soon if label is not removed. label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
protocol question stale For marking issues as stale. Labeled issues will be closed soon if label is not removed.
Projects
None yet
Development

No branches or pull requests

4 participants