Closed BrsPontes-Vortx closed 2 years ago
Hi Brian, good suggestion. Do you have any idea what the outline of this feature would look like in the code?
Hi Jhonathan, I have some idea, adding boolean variable in method that converts ignoreCamelCase
,
this is variable with the default value false and keeping the camelcase
but true case, the camel case is ignored, this way we keep the herbs pattern and we can add a cutomizable according to what we want
What do you think about this?
I believe that more than putting a flag on ignoring camel cases, we actually have a way of choosing the different types of cases that we would like to use.
@jhomarolo-vortx, Good morning, I think that different types would not be the ideal solution, we would be forcing them to use standards imposed by herbs
Exemple: method toUpperCase()
returns FOO
Instead of leaving patterns ready, by ignoring the camel case, if a developer wants to use FoOBaR or FooBar
it's possible
like this
let gql = ""
gql += `type ${ignoreCamelCase === true ? entity.name : upperFirst(camelCase(entity.name))} {\n`
gql += entityField2gql(entity)
gql += "}"
return gql
What do you think about this?
Why not pass a customName as option? With this my uc can be "Should Do Something", with my query being "showCustomBrebows"...
something like:
usecase2query( uc(), resolver(), { customName: "showCustomBrebows" } )
make sense?
Why not both?
if we use customName, ignore the flag of camelCase, else we can just ignore or not the camelCase as you has proposed...
I think is god idea
sorry guys. I've been late to this issue. I like the idea of change the convetions and I think this is very important to be able to bring your own. actually its one of the Herbs principles to be able to change these conventions (unlike imposed conventions like Rails).
however, we should improve herbs2gql and others herbs libraries and glues not in a small way (ex: ignoreCamelCase = true or false
) but in a more general way (for instance: nameConvetion : function(name) {...}
) so you can change to any way you want.
I think the current PR is too restrictive.
One more thing. We should have a more readble way to inform this optionals paramters.
Intead of
const gql = entity2type(givenAnEntity, nameConvetion, 'EntityCustom')
it could be
const gql = entity2type(givenAnEntity, { nameConvetion: nameFunc, entityName : 'EntityCustom' })
or even better
const conventions = { entityName: nameFunc }
const gql = entity2type(givenAnEntity, { conventions: conventions, entityName : 'EntityCustom' })
Good Morning, @dalssoft the pr that was sent has this change commented
Problem: In the application of VxNotification of resolvers' names are written in the format where the first letter of each word is capitalized, the first letter every word
SendWebHook
Herbal2gql returns in asendWebHook
camel case, this way we will have to change several applications that consume the notificationProposed Solution The solution at first would be to be able to optionally provide the name that could be returned together, or keep writing and not perform a conversion for the camel case