Skip to content

Commit ccb38cf

Browse files
authored
feat(AIP-156): allow singleton list (#1230)
1 parent 4dc9f98 commit ccb38cf

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

docs/rules/0156/forbidden-methods.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
rule:
33
aip: 156
44
name: [core, '0156', forbidden-methods]
5-
summary: Singletons must not define List, Create, or Delete methods.
5+
summary: Singletons must not define Create, or Delete methods.
66
permalink: /156/forbidden-methods
77
redirect_from:
88
- /0156/forbidden-methods
99
---
1010

1111
# Singletons: Forbidden methods
1212

13-
This rule enforces that singleton resources do not define `List`, `Create`, or
14-
`Delete` methods, as mandated in [AIP-156][].
13+
This rule enforces that singleton resources do not define `Create`, or `Delete`
14+
methods, as mandated in [AIP-156][].
1515

1616
## Details
1717

1818
This rule looks at any message with a `name` variable in the URI where the name
1919
ends in anything other than `*`. It assumes that this is a method operating on
20-
a singleton resource, and complains if the method is a `List`, `Create`, or
21-
`Delete` standard method.
20+
a singleton resource, and complains if the method is a `Create`, or `Delete`
21+
standard method.
2222

2323
## Examples
2424

rules/aip0156/forbidden_methods.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ var forbiddenMethods = &lint.MethodRule{
4242
return false
4343
},
4444
LintMethod: func(m *desc.MethodDescriptor) []lint.Problem {
45-
// Singletons should not use Create, List, or Delete.
46-
for _, badPrefix := range []string{"Create", "List", "Delete"} {
45+
// Singletons should not use Create, or Delete.
46+
for _, badPrefix := range []string{"Create", "Delete"} {
4747
if strings.HasPrefix(m.GetName(), badPrefix) {
4848
return []lint.Problem{{
4949
Message: fmt.Sprintf("Singletons must not define %q methods.", badPrefix),

rules/aip0156/forbidden_methods_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ func TestForbiddenMethods(t *testing.T) {
2929
}{
3030
{"ValidGet", "GetPublisherSettings", "/settings", testutils.Problems{}},
3131
{"ValidUpdate", "UpdatePublisherSettings", "/settings", testutils.Problems{}},
32+
{"ValidList", "ListPublisherSettings", "/settings", testutils.Problems{}},
3233
{"InvalidCreate", "CreatePublisherSettings", "/settings", testutils.Problems{{Message: "Create"}}},
33-
{"InvalidList", "ListPublisherSettings", "/settings", testutils.Problems{{Message: "List"}}},
3434
{"InvalidDelete", "DeletePublisherSettings", "/settings", testutils.Problems{{Message: "Delete"}}},
3535
{"Irrelevant", "CreatePublisher", "", testutils.Problems{}},
3636
} {

0 commit comments

Comments
 (0)