Skip to content

Commit 9d0ff86

Browse files
committed
aep-136: clarify and fix kebab-case usage in custom method URIs
- Add explicit example showing kebab-case vs camelCase in guidance - Fix Stateless Methods examples: :translateText → :translate-text - Update translate.oas.yaml path and description - Update translate.proto HTTP annotation Closes #408
1 parent c7b6e98 commit 9d0ff86

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

aep/general/0136/aep.md.j2

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ apply consistently:
2525
- The HTTP URI **must** use a `:` character followed by the custom verb
2626
(`:archive` in the above example), and the verb in the URI **must** match the
2727
verb in the name of the RPC.
28-
- If word separation is required, `kebab-case` **must** be used.
28+
- If word separation is required, `kebab-case` **must** be used
29+
(e.g. `:translate-text`, not `:translateText`).
2930
- The name of the RPC **should** be a verb followed by a noun.
3031
- The name of the RPC **must not** contain prepositions ("for", "with",
3132
etc.).
@@ -106,7 +107,7 @@ permanent effect on data within the API.
106107

107108
{% tab oas %}
108109

109-
{% sample 'translate.oas.yaml', '$.paths./projects/{projectId}:translateText' %}
110+
{% sample 'translate.oas.yaml', '$.paths./projects/{projectId}:translate-text' %}
110111

111112
{% endtabs %}
112113

@@ -116,7 +117,8 @@ permanent effect on data within the API.
116117
used.
117118
- The URI **should** place both the verb and noun after the `:` separator
118119
(avoid a "faux collection key" in the URI in this case, as there is no
119-
collection). For example, `:translateText` is preferable to `text:translate`.
120+
collection). For example, `:translate-text` is preferable to
121+
`text:translate`.
120122
- Stateless methods **must** use `POST` if they involve billing.
121123

122124
### Usage in declarative clients

aep/general/0136/translate.oas.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ info:
44
title: Library
55
version: 1.0.0
66
paths:
7-
/projects/{projectId}:translateText:
7+
/projects/{projectId}:translate-text:
88
post:
99
operationId: translateText
1010
description: Translates the provided text from one language to another.
@@ -37,7 +37,7 @@ paths:
3737
application/json:
3838
schema:
3939
description: |
40-
Response structure for the translateText operation.
40+
Response structure for the translate-text operation.
4141
properties:
4242
translated_text:
4343
type: string

aep/general/0136/translate.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ service Translate {
2222
// Translates the provided text from one language to another.
2323
rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) {
2424
option (google.api.http) = {
25-
post: "/v1/{project=projects/*}:translateText"
25+
post: "/v1/{project=projects/*}:translate-text"
2626
body: "*"
2727
};
2828
}

0 commit comments

Comments
 (0)