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
core/cap issues #36
Comments
Wiki endpoint is corrected Would it make sense to only return a single object though? Since there's the possibility for multiple results when you search all cores/caps, wouldn't that lead to inconsistency? Especially if more parameters are added to those endpoints in the future. |
All caps/cores should return an array, but by definition, if you're getting a single cap/core, IMO it doesn't make sense to return an array, as a serial should point to a single result. I'll leave it up to you :) |
I think consistent formatting is most important. It will definitely make
life easier for developers as you can write for loops to iterate through
the array and if array.length() = 1 then the for loops will run fine, if it
isn't just an object it will break the for loop
…On Thu, 27 Jul 2017 at 04:25, Brendan Kirchner ***@***.***> wrote:
All caps/cores should return an array, but by definition, if you're
getting a single cap/core, IMO it doesn't make sense to return an array, as
a serial should point to a single result.
I'll leave it up to you :)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#36 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AK6Ramrk00P87BCQ-mC55vGQ5A3oPaCGks5sSAMygaJpZM4OkvBf>
.
|
I disagree. There’d likely be no reason that the same code is consuming the single core/cap endpoint vs the all endpoint and any developer who is doing a single object request should know how to handle the single object that they’re expecting.
…Sent from my iPhone
On Jul 27, 2017, at 6:18 AM, HarvsG ***@***.***> wrote:
I think consistent formatting is most important. It will definitely make
life easier for developers as you can write for loops to iterate through
the array and if array.length() = 1 then the for loops will run fine, if it
isn't just an object it will break the for loop
On Thu, 27 Jul 2017 at 04:25, Brendan Kirchner ***@***.***>
wrote:
> All caps/cores should return an array, but by definition, if you're
> getting a single cap/core, IMO it doesn't make sense to return an array, as
> a serial should point to a single result.
>
> I'll leave it up to you :)
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#36 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AK6Ramrk00P87BCQ-mC55vGQ5A3oPaCGks5sSAMygaJpZM4OkvBf>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Here's an example of some endpoints taken from https://msdn.microsoft.com/en-us/library/dd203052.aspx http://i.imgur.com/vLZirxn.jpg Notice how the single object endpoints say "an individual..." vs. "a collection of..." |
Ok, I am with you now. Where the requester is expecting only a single object then it should not be an array. But in instances where the user is expecting 'one or more' objects it should always return an array even if there is only one object. E.g if it is a search term endpoint or something like |
@HarvsG absolutely. If it's a request for an unknown amount (0, 1, however many) it should (and kind of has to) be an array. But for the case where you're requesting a single object by ID (in this case core or cap serial) it should be a single object |
Agreed
…On 27 Jul 2017 16:11, "Brendan Kirchner" ***@***.***> wrote:
@HarvsG <https://github.com/harvsg> absolutely. If it's a request for an
unknown amount (0, 1, however many) it should (and kind of has to) be an
array. But for the case where you're requesting a single object by ID (in
this case core or cap serial) it should be a single object
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#36 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AK6Rag29aMAtwyrcmLk2127Q4Z8TFdYIks5sSKiwgaJpZM4OkvBf>
.
|
Glad we all agree, I'll go ahead and merge 👍 |
Sorry for all the issues being reported. This one's two parts
When fetching cap or core info for a single part (example: https://api.spacexdata.com/v1/parts/cores/B1036) it shouldn't return an array, just a single object
Also, the wiki entry for cap endpoints is incorrect. It lists the url as
https://api.spacexdata.com/v1/parts/caps/C106/
when it should be
https://api.spacexdata.com/v1/parts/caps/C106
as the first url produces an error
The text was updated successfully, but these errors were encountered: