Skip to content

Commit f88a51a

Browse files
authored
feat(librarian): allow APIs to have no service config (#1854)
This allows libraries from "just protos" to be represented. Fixes #1712.
1 parent e54a4f5 commit f88a51a

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

internal/librarian/state.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ func findServiceConfigIn(path string) (string, error) {
146146
}
147147
}
148148

149-
return "", errors.New("could not find service config in " + path)
149+
// No service config present: assume it's proto-only.
150+
return "", nil
150151
}
151152

152153
func saveLibrarianState(repoDir string, state *config.LibrarianState) error {

internal/librarian/state_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,22 +121,16 @@ func TestFindServiceConfigIn(t *testing.T) {
121121
want: "service_config.yaml",
122122
},
123123
{
124-
name: "non existed source path",
125-
path: filepath.Join("..", "..", "testdata", "non-existed-path"),
124+
name: "non-existent source path",
125+
path: filepath.Join("..", "..", "testdata", "non-existent-path"),
126126
want: "",
127127
wantErr: true,
128128
},
129129
{
130-
name: "non service config in a source path",
130+
name: "no service config in a source path",
131131
path: filepath.Join("..", "..", "testdata", "no_service_config"),
132132
want: "",
133-
wantErr: true,
134-
},
135-
{
136-
name: "simulated load error",
137-
path: filepath.Join("..", "..", "testdata", "no_service_config"),
138-
want: "",
139-
wantErr: true,
133+
wantErr: false,
140134
},
141135
{
142136
name: "invalid yaml",

0 commit comments

Comments
 (0)