Skip to content

Commit

Permalink
Go mod tidy and bar input/output docs defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed Jan 21, 2024
1 parent 4cb8a33 commit c7efcf6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,6 @@ github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaD
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
go.mongodb.org/mongo-driver v1.13.0 h1:67DgFFjYOCMWdtTEmKFpV3ffWlFnh+CYZ8ZS/tXWUfY=
go.mongodb.org/mongo-driver v1.13.0/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk=
go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo=
go.nanomsg.org/mangos/v3 v3.4.2 h1:gHlopxjWvJcVCcUilQIsRQk9jdj6/HB7wrTiUN8Ki7Q=
Expand Down
23 changes: 17 additions & 6 deletions internal/stream/docs.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
package stream

import (
"github.com/benthosdev/benthos/v4/internal/bundle"
"github.com/benthosdev/benthos/v4/internal/docs"
"github.com/benthosdev/benthos/v4/internal/pipeline"
)

// Spec returns a docs.FieldSpec for a stream configuration.
func Spec() docs.FieldSpecs {
return docs.FieldSpecs{
docs.FieldInput(fieldInput, "An input to source messages from.").HasDefault(map[string]any{
defaultInput := map[string]any{"inproc": ""}
if _, exists := bundle.GlobalEnvironment.GetDocs("stdin", docs.TypeInput); exists {
defaultInput = map[string]any{
"stdin": map[string]any{},
}),
}
}

defaultOutput := map[string]any{"inproc": ""}
if _, exists := bundle.GlobalEnvironment.GetDocs("stdout", docs.TypeOutput); exists {
defaultOutput = map[string]any{
"stdout": map[string]any{},
}
}

return docs.FieldSpecs{
docs.FieldInput(fieldInput, "An input to source messages from.").HasDefault(defaultInput),
docs.FieldBuffer(fieldBuffer, "An optional buffer to store messages during transit.").HasDefault(map[string]any{
"none": map[string]any{},
}),
pipeline.ConfigSpec(),
docs.FieldOutput(fieldOutput, "An output to sink messages to.").HasDefault(map[string]any{
"stdout": map[string]any{},
}),
docs.FieldOutput(fieldOutput, "An output to sink messages to.").HasDefault(defaultOutput),
}
}

0 comments on commit c7efcf6

Please sign in to comment.