Skip to content

Commit

Permalink
operation-id and tag
Browse files Browse the repository at this point in the history
  • Loading branch information
reuvenharrison committed Sep 7, 2024
1 parent 407ad51 commit 7a89f47
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
13 changes: 11 additions & 2 deletions checker/generator/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ var endpointValueSets = ValueSets{
},
ValueSetA{
nouns: []string{"api path", "api"},
actions: []string{"add", "remove"},
adverb: "without deprecation",
actions: []string{"remove"},
adverb: []string{"without deprecation", "before sunset"},
},
ValueSetB{
nouns: []string{"endpoint"}, // /Paths/PathItem
Expand All @@ -74,6 +74,15 @@ var endpointValueSets = ValueSets{
nouns: []string{"success response status", "non-success response status"}, // /Paths/PathItem/Operation/Responses/Response/content/media-type/
actions: []string{"add", "remove"},
},
ValueSetA{
nouns: []string{"operation id"},
actions: []string{"change"},
},
ValueSetB{
predicativeAdjective: "%s",
nouns: []string{"operation id", "tag"},
actions: []string{"add", "remove"},
},
ValueSetB{
predicativeAdjective: "%s",
hierarchy: []string{"endpoint security scheme"},
Expand Down
9 changes: 7 additions & 2 deletions checker/generator/messages.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
stability-decreased: stability was decreased from %s to %s
api-path-added: api path was added without deprecation
api-path-removed: api path was removed without deprecation
api-added: api was added without deprecation
api-path-removed: api path was removed before sunset
api-removed: api was removed without deprecation
api-removed: api was removed before sunset
endpoint-added: added endpoint
endpoint-removed: removed endpoint
endpoint-deprecated: deprecated endpoint
Expand All @@ -11,6 +11,11 @@ success-response-status-added: added success response status %s
success-response-status-removed: removed success response status %s
non-success-response-status-added: added non-success response status %s
non-success-response-status-removed: removed non-success response status %s
operation-id-changed: operation id was changed from %s to %s
operation-id-added: added operation id %s
operation-id-removed: removed operation id %s
tag-added: added tag %s
tag-removed: removed tag %s
endpoint-security-scheme-security-scope-added: added security scope %s to endpoint security scheme %s
endpoint-security-scheme-security-scope-removed: removed security scope %s from endpoint security scheme %s
request-body-media-type-max-set: max value of media-type %s of request body was set to %s
Expand Down
13 changes: 10 additions & 3 deletions checker/generator/value_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type ValueSet struct {
hierarchy []string
nouns []string
actions []string
adverb string
adverb []string
}

func (v ValueSet) setHierarchy(hierarchy []string) ValueSet {
Expand Down Expand Up @@ -70,8 +70,15 @@ func (v ValueSetA) generate(out io.Writer) {
for _, noun := range v.nouns {
for _, action := range v.actions {
id := generateId(v.hierarchy, noun, action)
message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action, v.adverb)
fmt.Fprintln(out, fmt.Sprintf("%s: %s", id, message))

adverbs := v.adverb
if v.adverb == nil {
adverbs = []string{""}
}
for _, adverb := range adverbs {
message := generateMessage(v.hierarchy, noun, v.attributiveAdjective, v.predicativeAdjective, action, adverb)
fmt.Fprintln(out, fmt.Sprintf("%s: %s", id, message))

Check failure on line 80 in checker/generator/value_set.go

View workflow job for this annotation

GitHub Actions / lint

S1038: should use fmt.Fprintf instead of fmt.Fprintln(fmt.Sprintf(...)) (but don't forget the newline) (gosimple)
}
}
}
}
Expand Down

0 comments on commit 7a89f47

Please sign in to comment.