-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Propose array in parameters #240
Comments
@huiyiqun I would definitely love to simplify describing arrays of URI query parameters – lots of framework seems to be using reserved square brackets characters ( Are you proposing that declaring a URI query parameter as an array (e.g. What about parameter names like |
I'd vote for being unambiguous, thus explicitly dealing with the "or" in the original proposal. I think the
Note: the first notation,
Hmm, this never came to my mind! Do you see this often in the wild? To me, it seems to me more like a mapping, thus it's beyond the capabilities of |
I really really don't like this. I think there are three separate conventions people use:
While the 1 and 2 are the popular ones, you can still find 3 in the wild. When people use one of the first two, the third one generally represents overwriting a parameter (which I think is conceptually correct). Objects are generally represented as |
Reserved square brackets characters is a de-facto standard for most framework such as expressjs and php. As @honzajavorek says, '[]' needs additional escape and I feel it hard to comprehend. What's more, I think |
The problem is that I think we cannot make assumptions based on our thoughts like this. I have also my ideals about how APIs should look like, but people will want to describe their APIs in API Blueprint regardless of what we think is the best approach. We can champion a certain way to specify something, but we shouldn't prevent other approaches, even "ugly" ones, at the same time. Sometimes it also happens a valid use case it provided for the "ugly" approach and the author then may struggle how deal with obstacles we prepared for them. If |
IIRC, this means that |
According to the RFC of uri template
But there is so many developers take
WHITHOUT needing escape? |
Not to my knowledge. You can specify how many values you want for a single parameter like this and you can normally get them all in server code. I've seen it implemented, I've seen it in frameworks. The |
according to this RFC, I think this solution is general: ## Videos [/video{?status}]
+ Parameters
+ status (array[int]) means:
## Videos [/video{?status*}]
+ Parameters
+ status (array[int]) means:
## Videos [/video{?status[]*}]
+ Parameters
+ `status[]` (array[int]) means:
|
So what about the Or maybe take use of some general purpose library like this |
yes, whether |
I see this as converging to what is being discussed in #252 . See my latest proposal there #252 (comment) |
RFC proposal of syntax addressing this issue: apiaryio/api-blueprint-rfcs#3. Please track and comment on the RFC. Thank you! |
means:
or:
The text was updated successfully, but these errors were encountered: