Skip to content

Commit 4014b97

Browse files
committed
fix: rename exclude resource definitions flag
Aligns with aip-go.
1 parent dfba348 commit 4014b97

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ insertion_point If non-empty, indicates that the named file should alrea
4040
and the content here is to be inserted into that file at a defined
4141
insertion point.
4242

43-
skip_file_resource_definitions
43+
exclude_resource_definitions
4444
If set to true, resource names will not be generated for resource definitions
45-
in the file scope. Default: false.
45+
in the file scope, only on messages. Default: false.
4646
```
4747
4848
---

internal/plugin/generate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func Generate(request *pluginpb.CodeGeneratorRequest) (*pluginpb.CodeGeneratorRe
4242
if _, ok := generate[descriptor.ParentFile]; !ok {
4343
return true
4444
}
45-
if opts.SkipFileResourceDefinitions && !isMessageResourceDescriptor(descriptor) {
45+
if opts.ExcludeResourceDefinitions && !isMessageResourceDescriptor(descriptor) {
4646
return true
4747
}
4848
dir := path.Dir(descriptor.ParentFile)

internal/plugin/options.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type Options struct {
1515
// Defaults to `""` (ie. no insertion point)
1616
InsertionPoint string
1717

18-
// SkipFileResourceDefinitions disables generation of resource names
19-
// declared in the file scope.
18+
// ExcludeResourceDefinitions disables generation of resource names
19+
// based on resource definitions in the file.
2020
// Defaults to false.
21-
SkipFileResourceDefinitions bool
21+
ExcludeResourceDefinitions bool
2222
}
2323

2424
func defaultOptions() Options {
@@ -51,12 +51,12 @@ func (o *Options) Unmarshal(s *string) error {
5151
o.InsertionPoint = value
5252
case "filename":
5353
o.Filename = value
54-
case "skip_file_resource_definitions":
54+
case "":
5555
b, err := unmarshalBool(value)
5656
if err != nil {
57-
return fmt.Errorf("unmarshal skip_file_resource_definitions: %w", err)
57+
return fmt.Errorf("unmarshal exclude_resource_definitions: %w", err)
5858
}
59-
o.SkipFileResourceDefinitions = b
59+
o.ExcludeResourceDefinitions = b
6060
default:
6161
return fmt.Errorf("unknown option [%s]", opt)
6262
}

0 commit comments

Comments
 (0)