You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the options that we want to make available to users is the disableTrailingSlash which removes the trailing slash appending and type layer validation for custom calls (and builtin).
We want to get the right type validation whenever we enable this flag or not. We can do that easily on the createApi method but it is hard to translate this to custom calls.
The main issue I think it is that custom calls are isolated call (createCustomServiceCall) from the api.
We should probably make these two be the same so we don’t mess up on the types there
This is what we could probably do
constapi=createApi({client,baseUri,models,options})// api does not have csc type here...api.addCustomCall('<name>',{ inputShape,outputShape,filtersShape,cb })//... the custom call (with the right type inference from options)
I am not a big fan of giving a string literal for the name, it would be nice if the user could just define their own name. An alternative would be that they define an object, and addCustomCall takes it and merge it to current custom calls “cache”
I think this one is a better implementation, it does not only give users the power to choose their name to their like on their custom calls but it also allows them to just add multiple custom calls at once, without the need of having to do createCustomServiceCall
Something that comes to mind here is that we might need to rework the type layer for createApi if we want to do something like this. Given that we will need to do type builder pattern to achieve what we're mentioning here. To do so, we will probably have to get rid of the createApi type overloads, which are a bit painful to work with at times.
The text was updated successfully, but these errors were encountered:
The problem
One of the options that we want to make available to users is the
disableTrailingSlash
which removes the trailing slash appending and type layer validation for custom calls (and builtin).We want to get the right type validation whenever we enable this flag or not. We can do that easily on the
createApi
method but it is hard to translate this to custom calls.The main issue I think it is that custom calls are isolated call (createCustomServiceCall) from the api.
We should probably make these two be the same so we don’t mess up on the types there
This is what we could probably do
I am not a big fan of giving a string literal for the name, it would be nice if the user could just define their own name. An alternative would be that they define an object, and
addCustomCall
takes it and merge it to current custom calls “cache”I think this one is a better implementation, it does not only give users the power to choose their name to their like on their custom calls but it also allows them to just add multiple custom calls at once, without the need of having to do
createCustomServiceCall
Something that comes to mind here is that we might need to rework the type layer for
createApi
if we want to do something like this. Given that we will need to do type builder pattern to achieve what we're mentioning here. To do so, we will probably have to get rid of the createApi type overloads, which are a bit painful to work with at times.The text was updated successfully, but these errors were encountered: