Skip to content

Commit 504f849

Browse files
authored
fix: Make gen docs work without auth (#1052)
<!-- Explain what problem this PR addresses --> ---
1 parent ba632d1 commit 504f849

17 files changed

+61
-44
lines changed

docs/templates/table.md.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ The following tables depend on {{.Name}}:
4040
| Name | Type |
4141
| ------------- | ------------- |
4242
{{- range $column := $.Columns }}
43-
|{{$column.Name}}{{if $column.PrimaryKey}} (PK){{end}}{{if $column.IncrementalKey}} (Incremental Key){{end}}|{{$column.Type}}|
43+
|{{$column.Name}}{{if $column.PrimaryKey}} (PK){{end}}{{if $column.IncrementalKey}} (Incremental Key){{end}}|`{{$column.Type}}`|
4444
{{- end }}

docs/testdata/TestGeneratePluginDocs-Markdown-incremental_table.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ It supports incremental syncs based on the (**id_col**, **id_col2**) columns.
1111

1212
| Name | Type |
1313
| ------------- | ------------- |
14-
|int_col|int64|
15-
|id_col (PK) (Incremental Key)|int64|
16-
|id_col2 (Incremental Key)|int64|
14+
|int_col|`int64`|
15+
|id_col (PK) (Incremental Key)|`int64`|
16+
|id_col2 (Incremental Key)|`int64`|

docs/testdata/TestGeneratePluginDocs-Markdown-relation_relation_table_a.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ This table depends on [relation_table](relation_table.md).
1414

1515
| Name | Type |
1616
| ------------- | ------------- |
17-
|string_col|utf8|
17+
|string_col|`utf8`|

docs/testdata/TestGeneratePluginDocs-Markdown-relation_relation_table_b.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ This table depends on [relation_table](relation_table.md).
1414

1515
| Name | Type |
1616
| ------------- | ------------- |
17-
|string_col|utf8|
17+
|string_col|`utf8`|

docs/testdata/TestGeneratePluginDocs-Markdown-relation_table.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ The following tables depend on relation_table:
1818

1919
| Name | Type |
2020
| ------------- | ------------- |
21-
|string_col|utf8|
21+
|string_col|`utf8`|

docs/testdata/TestGeneratePluginDocs-Markdown-test_table.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ The following tables depend on test_table:
1616

1717
| Name | Type |
1818
| ------------- | ------------- |
19-
|int_col|int64|
20-
|id_col (PK)|int64|
21-
|id_col2 (PK)|int64|
22-
|json_col|json|
23-
|list_col|list<item: int64, nullable>|
24-
|map_col|map<utf8, int64, items_nullable>|
25-
|struct_col|struct<string_field: utf8, int_field: int64>|
19+
|int_col|`int64`|
20+
|id_col (PK)|`int64`|
21+
|id_col2 (PK)|`int64`|
22+
|json_col|`json`|
23+
|list_col|`list<item: int64, nullable>`|
24+
|map_col|`map<utf8, int64, items_nullable>`|
25+
|struct_col|`struct<string_field: utf8, int_field: int64>`|

internal/memdb/memdb.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ func GetNewClient(options ...Option) plugin.NewClientFunc {
4848
for _, opt := range options {
4949
opt(c)
5050
}
51-
return func(context.Context, zerolog.Logger, []byte) (plugin.Client, error) {
51+
return func(context.Context, zerolog.Logger, []byte, plugin.NewClientOptions) (plugin.Client, error) {
5252
return c, nil
5353
}
5454
}
5555

56-
func NewMemDBClient(ctx context.Context, l zerolog.Logger, spec []byte) (plugin.Client, error) {
57-
return GetNewClient()(ctx, l, spec)
56+
func NewMemDBClient(ctx context.Context, l zerolog.Logger, spec []byte, options plugin.NewClientOptions) (plugin.Client, error) {
57+
return GetNewClient()(ctx, l, spec, options)
5858
}
5959

60-
func NewMemDBClientErrOnNew(context.Context, zerolog.Logger, []byte) (plugin.Client, error) {
60+
func NewMemDBClientErrOnNew(context.Context, zerolog.Logger, []byte, plugin.NewClientOptions) (plugin.Client, error) {
6161
return nil, fmt.Errorf("newTestDestinationMemDBClientErrOnNew")
6262
}
6363

@@ -123,7 +123,7 @@ func (c *client) Sync(_ context.Context, options plugin.SyncOptions, res chan<-
123123
return nil
124124
}
125125

126-
func (c *client) Tables(_ context.Context) (schema.Tables, error) {
126+
func (c *client) Tables(context.Context, plugin.TableOptions) (schema.Tables, error) {
127127
tables := make(schema.Tables, 0, len(c.tables))
128128
for _, table := range c.tables {
129129
tables = append(tables, table)

internal/memdb/memdb_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func TestPlugin(t *testing.T) {
1111
ctx := context.Background()
1212
p := plugin.NewPlugin("test", "development", NewMemDBClient)
13-
if err := p.Init(ctx, nil); err != nil {
13+
if err := p.Init(ctx, nil, plugin.NewClientOptions{}); err != nil {
1414
t.Fatal(err)
1515
}
1616
plugin.TestWriterSuiteRunner(
@@ -25,7 +25,7 @@ func TestPlugin(t *testing.T) {
2525
func TestPluginOnNewError(t *testing.T) {
2626
ctx := context.Background()
2727
p := plugin.NewPlugin("test", "development", NewMemDBClientErrOnNew)
28-
err := p.Init(ctx, nil)
28+
err := p.Init(ctx, nil, plugin.NewClientOptions{})
2929

3030
if err == nil {
3131
t.Fatal("expected error")
@@ -36,7 +36,7 @@ func TestOnWriteError(t *testing.T) {
3636
ctx := context.Background()
3737
newClientFunc := GetNewClient(WithErrOnWrite())
3838
p := plugin.NewPlugin("test", "development", newClientFunc)
39-
if err := p.Init(ctx, nil); err != nil {
39+
if err := p.Init(ctx, nil, plugin.NewClientOptions{}); err != nil {
4040
t.Fatal(err)
4141
}
4242
if err := p.WriteAll(ctx, nil); err.Error() != "errOnWrite" {

internal/servers/destination/v0/destinations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (s *Server) Configure(ctx context.Context, req *pbBase.Configure_Request) (
4444
if err != nil {
4545
return nil, status.Errorf(codes.InvalidArgument, "failed to marshal spec: %v", err)
4646
}
47-
return &pbBase.Configure_Response{}, s.Plugin.Init(ctx, pluginSpec)
47+
return &pbBase.Configure_Response{}, s.Plugin.Init(ctx, pluginSpec, plugin.NewClientOptions{})
4848
}
4949

5050
func (s *Server) GetName(context.Context, *pbBase.GetName_Request) (*pbBase.GetName_Response, error) {

internal/servers/destination/v1/destinations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (s *Server) Configure(ctx context.Context, req *pb.Configure_Request) (*pb.
5454
if err != nil {
5555
return nil, status.Errorf(codes.InvalidArgument, "failed to marshal spec: %v", err)
5656
}
57-
return &pb.Configure_Response{}, s.Plugin.Init(ctx, pluginSpec)
57+
return &pb.Configure_Response{}, s.Plugin.Init(ctx, pluginSpec, plugin.NewClientOptions{})
5858
}
5959

6060
func (s *Server) GetName(context.Context, *pb.GetName_Request) (*pb.GetName_Response, error) {

0 commit comments

Comments
 (0)