Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/cli/cmd/attached_integration_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func newAttachedIntegrationAttachCmd() *cobra.Command {
}

// Parse and validate options
opts, err := parseAndValidateOpts(options, item.Attachment)
opts, err := ParseAndValidateOpts(options, item.Attachment)
if err != nil {
// Show schema table if validation fails
if err := RenderSchemaTable("Available options", item.Attachment.Properties); err != nil {
Expand Down
10 changes: 5 additions & 5 deletions app/cli/cmd/registered_integration_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func newRegisteredIntegrationAddCmd() *cobra.Command {
}

// Parse and validate options
opts, err := parseAndValidateOpts(options, item.Registration)
opts, err := ParseAndValidateOpts(options, item.Registration)
if err != nil {
// Show schema table if validation fails
if err := RenderSchemaTable("Available options", item.Registration.Properties); err != nil {
Expand Down Expand Up @@ -79,9 +79,9 @@ func newRegisteredIntegrationAddCmd() *cobra.Command {
return cmd
}

func parseAndValidateOpts(opts []string, schema *action.JSONSchema) (map[string]any, error) {
func ParseAndValidateOpts(opts []string, schema *action.JSONSchema) (map[string]any, error) {
// Parse
res, err := parseKeyValOpts(opts, schema.Properties)
res, err := ParseKeyValOpts(opts, schema.Properties)
if err != nil {
return nil, fmt.Errorf("failed to parse options: %w", err)
}
Expand All @@ -101,10 +101,10 @@ func parseAndValidateOpts(opts []string, schema *action.JSONSchema) (map[string]
return res, nil
}

// parseKeyValOpts performs two steps
// ParseKeyValOpts performs two steps
// 1 - Split the options into key/value pairs
// 2 - Cast the values to the expected type defined in the schema
func parseKeyValOpts(opts []string, propertiesMap sdk.SchemaPropertiesMap) (map[string]any, error) {
func ParseKeyValOpts(opts []string, propertiesMap sdk.SchemaPropertiesMap) (map[string]any, error) {
// 1 - Split the options into key/value pairs
var options = make(map[string]any)
for _, opt := range opts {
Expand Down
Loading