-
Notifications
You must be signed in to change notification settings - Fork 737
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
Node.js doesn't name it's operation classes the same as other languages #1491
Comments
@amarzavery @jasper-schneider |
Hey @matthchr ... are you talking about the You're correct in that 'fixing' that now would be quite a bit of a breaking change. I think we're going to have to bring this up for discussion; this is certainly something that I've noticed, and we're starting to get some inconsistency. |
I thought the naming of the operation groups actually is part of the base generator, not the But yes, I am talking about the inconsistencies in naming behavior between the languages, specifically the fact that node doesn't append My main complaint is that if every language does it's own thing with naming (and the subsequent conflicts) it becomes harder and harder to pick names to minimize conflicts in all languages. And then you get awkward looking interfaces in some languages like my team has for node now, where we have |
Adding this as a feature consideration for vNext generators. (see #2448) |
In C#, the operations classes and properties seem to be named consistently like so (assume no conflicts currently):
Swagger:
BatchAccount_Create
- an operationC#
class BatchAccountOperations
- the class containing the operations associated with a Batch accountBatchClient.BatchAccount
- a property on the clientPython
class BatchAccountOperations(object)
- the class containing the operations associated with a Batch accountBatchClient.batch_account
- the property on the clientNode
function BatchAccount(client) {
- the class containing the operations associated with a Batch accountBatchClient.batchAccount
- the property on the clientNow if we add in a model type to our Swagger that conflicts with the operation group name in the Swagger spec we get the following changes:
BatchAccount
- a model in the Swagger specificationC#: No changes
Python: No changes
Node.js: Renames the class and the property to be
BatchAccountOperations
andbatchAccountOperations
respectively.This is problematic because it easily leads me to a client that looks like this:
client.fooOperations
,client.bar
,client.bazOperations
,client.qux
(i.e. my properties aren't consistently named, either with anOperations
suffix or otherwise).This leads me to my real question:
Why doesn't node just do what C# and Python do, and always append operations on the class name (it can append it or not on the property name, as long as it consistently does so). To me this seems to have a few benefits:
BatchAccount
as in my example above)The downsides of this:
If you're not willing to accept this change, here are some other ideas that might help alleviate this issue...
The text was updated successfully, but these errors were encountered: