Open nikolasburk opened 7 years ago
personally, I like fromEvent
, it sounds like a builder function that takes an event, which it is. Maybe it could be more explicit like apiFromEvent
? But I don't think it's necessary.
But what does it build? the name doesn’t give any context on what the result of the function will be. I think the fact that it’s coming from an event would ideally be transported through the parameter name/type, smth like: api(event: Event)
. I think apiFromEvent(event: Event)
might be a good compromise.
Also, maybe I'm the only one who's confused by that naming? Would like to hear other people's opinions :)
apiFromEvent
is wrong, because it returns the Graphcool object. .api(...)
returns the api.
You're right, @kbrandwijk. Your point makes me think even more that the current terminology is fine. But yea, I'm open for a discussion here, too.
It should be noted that this would be a big breaking change for functions on the legacy function runtime (those were the latest version is resolved when updating an existing or creating a new function).
I think the naming is fine. As it's a factory function, it could have started with a capital, but other than that, and given the fact it's a breaking change, I wouldn't worry about it.
@nikolasburk to distract you from it, try running this query here :wink: :see_no_evil:
query {
repository(owner:"graphcool", name:"graphcool") {
issues(states:OPEN) {
totalCount
}
}
}
I think the
fromEvent
function should be renamed to something that expresses what it does. A few suggestions:graphcoolProjectContext
(orgetGraphcoolProjectContext
)graphcoolProject
(orgetGraphcoolProject
)graphcoolAPI
(orgetGraphcoolAPI
)