Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
hariso committed Nov 18, 2024
1 parent ab77011 commit 2b4394a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
4 changes: 2 additions & 2 deletions specgen/specgen/specgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func WriteAndCombine(yamlBytes []byte, path string) error {
}

// Merge the new map into the existing map, preserving existing fields
connectorUnknownFields, _ := unknownFields["connector"].(map[string]any)
connectorUnknownFields, _ := unknownFields["specification"].(map[string]any)
connTyp := reflect.TypeFor[v1.ConnectorSpecification]()
for i := range connTyp.NumField() {
f := connTyp.Field(i)
Expand All @@ -114,7 +114,7 @@ func WriteAndCombine(yamlBytes []byte, path string) error {
}

delete(unknownFields, "version")
delete(unknownFields, "connector")
delete(unknownFields, "specification")

out.UnknownFields = unknownFields
out.Specification.UnknownFields = connectorUnknownFields
Expand Down
11 changes: 0 additions & 11 deletions specgen/specgen/testdata/simple/specs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,9 @@ import (
sdk "github.com/conduitio/conduit-connector-sdk"
)

// GlobalConfig is a reusable config struct used in the source and destination
// config.
type GlobalConfig struct {
// MyGlobalString is a required field in the global config with the name
// "foo" and default value "bar".
MyGlobalString string `json:"foo" default:"bar" validate:"required"`
}

type SourceConfig struct {
sdk.UnimplementedSourceConfig

// GlobalConfig parameters should be nested under "global". This comment
// should be ignored.
Global GlobalConfig `json:"global"`
/*
MyInt has a block comment.
And it spans multiple lines.
Expand Down

0 comments on commit 2b4394a

Please sign in to comment.