-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add query parameters for catalog controller #296
Conversation
9e53ea8
to
12f7147
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! just a tiny thing about a query string parameter.
@@ -76,16 +72,14 @@ const ChecksResults = () => { | |||
const dispatchUpdateCatalog = () => { | |||
dispatch({ | |||
type: 'UPDATE_CATALOG', | |||
payload: { flat: '', provider: 'azure' }, //FIXME: Get provider properly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would translato toa query string like this
/api/checks/catalog?flat=&provider=azure
I would make it flat=true
, I find it a bit more robust.
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current scenario the queries like flat&provider=azure
and flat=&provider=azure
, both would work. I often time think that booleans are a tricky thing, because each language has their own syntax with true|True|1
etc hehe.
I read that if the query param is a boolean having it without any parameter is pretty normal. But I don't have any issue changing it. What is the most normal thing out there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in elixir we can check the parameter directly since nil
is a falsy value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current scenario the queries like
flat&provider=azure
andflat=&provider=azure
, both would work
Yes, they would both work. I just find it a bit inconsistent and ambiguous as a contract.
booleans are a tricky thing, because each language has their own syntax with true|True|1 etc
I see, it is also true that URLs should be independent from the language serving or consuming 😄
If then there is some language constraints in handling urls, that's another topic 😄
That said no big issue for me 👍, anyway we do not yet have real API consumers to take care of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabriziosestito @nelsonkopliku At the end, what is the conclusion? Should I change it?
in elixir we can check the parameter directly since nil is a falsy value
I'm not able to decipher your message @fabriziosestito XD
12f7147
to
a2471e2
Compare
a2471e2
to
4f0f66e
Compare
Some small improvements on the catalog controller usage:
api/cluster/checks?provider=azure
)get_catalog_by_provider
toget_catalog_grouped_by_provider
to be more meaningful