-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Naming convention? #475
Comments
I'm not aware of any naming rules beyond the style guide. Personally I use CRUDL as my prefix then the singular form of the resource in question and map the information from the query string into the request body for the rpc. Here is what I would do (please forgive the pseudocode)
Note the omission of PATCH examples. I generally try not to implement patch. I've found it to be mostly an antifeature and very difficult to get right. Completely replacing the record is usually better. One of the very nice features about this is that when you want to add a new endpoint it is often as simple as giving it the URL you would expect and it will generally just work! If you're interacting from gRPC directly then I would avoid REST semantics, after all you're writing an RPC API. |
Thanks for your reply. That's what I was hoping for. Personally, I don't used Question: How can you use two different RPCs with the same name but different arguments in gRPC (e.g. The guessability aspect is what I had in mind when I was asking for a naming convention. |
FWIW: In the meantime (i.e. before reading your reply) I thought some more about my own preference and came up with the following. The main difference is that I use more than one noun in the RPC names (e.g. to prevent the "is already defined" problem):
|
The thing I was trying to get at in my comment above is that conceptually |
I'm going to close this since there hasn't been movement ina while. Please reopen if you have more questions. |
Is there a naming convention that maps HTTP methods + REST resource paths to gRPC procedure names?
I.e. how would you name the gRPC procedures of the following REST endpoints?
Here are some suggestions with alternatives...
I'm thinking about details like "All" in the procedure name, singular vs plural,
For
vsOf
,Get
vsRead
vsRetrieve
,Update
vsModify
,Delete
vsDestroy
, CRUD vs HTTP method names, etc. Any thoughts or preferences?Of course the answer also depends on the programming language. I'm especially interested in Go.
Are the any conventions or best practices?
Maybe we can put the conclusion (together with rationales) into the FAQ?
The text was updated successfully, but these errors were encountered: