question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for arbitrary query strings

See original GitHub issue

Hello! I’m trying to use the OpenAPI 3.0 spec to document an API that supports a subset of the Resource Query Language (RQL). However, because this query string format doesn’t adhere to the typical name=value parameter structure, I’m struggling to express it in OpenAPI.

For example, a valid query string might be: http://localhost:5000/books?select(title,author)&gt(published,2000-06-30T12:20:08Z)&sort(published).

I wouldn’t expect OpenAPI to understand RQL, but if there were a way to specify that an endpoint may have a query string, and that the query string contents are beyond the scope of OpenAPI, that would suffice. (I’m really thinking from the Swagger UI perspective – so a user wanting to try the API can type in the entire RQL query string themselves.)

If anyone has any thoughts on other ways this can be accomplished with the existing 3.0 specification, that would be great too!

Thanks, Paul

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
hkosovacommented, Feb 25, 2020

@keyz182 your scenario can be described by using a deepObject-style parameter:

      - in: query
        name: filter
        required: false
        schema:
          type: object
          additionalProperties: true
          example:
            foo: bar
            inputs.datetime.gte: 242839744
        style: deepObject

        # The example translates to:
        # ?filter[foo]=bar&filter[inputs.datetime.gte]=242839744
1reaction
handrewscommented, Mar 6, 2018

@pofallon yeah that is why I was thinking we’d need a new “in” value. in: query assumes application/x-www-form-urlencoded. The content just applies to the value of the URL-encoded value, not the query string as a whole.

So in: queryContent or in: wholeQueryString or something like that.

(troll mode: or, just fully support RFC 6570 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I support arbitrary querystring params? (explode ...
My API allows users to filter a database table using query string params (ie. ?age=30&location=Philadelphia ). These params are different ...
Read more >
How to Use Query Strings and Parameters for Marketers
This is a guide on query strings and parameters for marketers. Learn how to use text in a URL (query strings) for UTM...
Read more >
Query parameter targeting - Optimize Resource Hub
Query parameter targeting explicitly targets values that occur in the query string of a URL. Query parameters are found between the question mark...
Read more >
Passing Information via Query Strings - Qualtrics
The second query string begins with an ampersand (&) instead of a question mark (?). This is because URLs can only support one...
Read more >
Caching content based on query string parameters
Don't forward query strings to the origin at all. · Forward query strings to the origin, and cache based on all parameters in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found