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

How to document QueryBuilder parameters? #20

Closed
anychmguy opened this issue Aug 17, 2018 · 2 comments
Closed

How to document QueryBuilder parameters? #20

anychmguy opened this issue Aug 17, 2018 · 2 comments
Labels

Comments

@anychmguy
Copy link

anychmguy commented Aug 17, 2018

Hi
I'm usin https://github.com/spatie/laravel-query-builder in my API, which requires parameters like:

https://example.org/api/cars?filter[model_id]=1&filter[brand_id]=2

But when trying to write API Blueprint for this, this package does not render well those parameters.

I tried the following variations:
screenshot_20180817_073059

But it does not print nothing in the parameters section

Also tried encoding the characters
screenshot_20180817_073223

But it prints the codes instead of the characters:
screenshot_20180817_072614

Also tried escaping the parameters:
screenshot_20180817_072921

but it does not print the parameters section

@M165437
Copy link
Owner

M165437 commented Aug 22, 2018

Thanks! I will have a look.

@M165437
Copy link
Owner

M165437 commented Sep 7, 2018

@anychmguy API Blueprint doesn't support associative arrays as url parameteres. Have a look at the discussion of api-blueprint/issues/240. There is an MSON RFC proposal addressing this issue, but it hasn't been implemented yet.

In the meantime, plain parameters are an easy way to add basic filtering:

## Cars [/cars{?model}{&brand}]

Cars API

### Gets a list of cars [GET]

Get the list of registered cars

+ Request
    + Headers

        Authorization: Bearer <token>

+ Parameters
    + model: `123` (number) - Model of the Car
    + brand: `456` (number) - Brand of the Car

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

No branches or pull requests

2 participants