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

Allow query on non-query get request #110

Closed
jirenius opened this issue Sep 26, 2019 · 1 comment
Closed

Allow query on non-query get request #110

jirenius opened this issue Sep 26, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@jirenius
Copy link
Collaborator

Issue

The RES protocol currently doesn't allow responding with a query resource on a non-query get request. In the RES Service Protocol - Get request, it states in the Result section:

query
MUST be omitted if the request had no query parameter.

This restriction should be removed as it may cause unnecessary complexity for service development of query resource that uses default values for omitted query parameters.

Use case

Assume we have a collection of a million items, but the service wish to only expose the collection as a query resource where a from and limit parameter may be provided to specify the span.

To simplify the request, omitting any of the two parameters will have the service fall back to the default values (eg. from=0&limit=50).

If both parameters were omitted, the query would be empty, and due to the restriction it would no longer accept a normalized query in the response. This would currently force the developers to either:

  1. Add specific non-query handling on the service for the default params usecase.
  2. Add a dummy property to the query (eg. ignore=this) on the request

This scenario would be solved if the restriction was lifted.

Example request

Request body for get.example.list:

{ }

Response:

{
    "result": {
        "collection": [{ "rid": "example.item.1" }, ... , { "rid": "example.item.50" }],
        "query": "from=0&limit=50"
    }
}

Compatibility

Removing the restriction would:

  • be backwards compatible (running older services on a newer versions of Resgate)
  • have no impact on client
@jirenius jirenius added the enhancement New feature or request label Sep 26, 2019
@jirenius jirenius self-assigned this Sep 26, 2019
jirenius added a commit that referenced this issue Sep 27, 2019
jirenius added a commit that referenced this issue Sep 30, 2019
…non-query-get-request

Feature/gh 110 allow query on non query get request
@jirenius
Copy link
Collaborator Author

Resolved in PR #117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant