Skip to content

Conversation

@iignatevich
Copy link
Collaborator

No description provided.

defaultJSON = string(jsonBytes)
}
}
val = flags.StringP(param.Name, param.Shorthand, defaultJSON, desc+" (JSON format)")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need tests on how it renders in the templates. Not sure what we have for the moment.

}
case jsonschema.Object:
// Handle object as a JSON string
defaultJSON := "{}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have defaults set elsewhere. Please, make it one way. Maybe define a new Cobra Value Handler. Object must work for arguments and options.

case *string:
return *v
str := *v
// Check for raw JSON prefix
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it. Please, reflect in the documentation how to use objects.

@iignatevich iignatevich force-pushed the cobra_object_support branch 4 times, most recently from 5d9caf6 to 76b5b56 Compare July 4, 2025 13:47
3. `integer`
4. `number` - float64 values
5. `array` (currently array of 1 supported type)
6. `object` - parses string as json string into map[string]any
Copy link
Collaborator Author

@iignatevich iignatevich Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update doc
test args and enums

@iignatevich iignatevich force-pushed the cobra_object_support branch from 76b5b56 to 177a6ba Compare July 4, 2025 14:12
@iignatevich iignatevich force-pushed the cobra_object_support branch from 177a6ba to b57ca11 Compare July 4, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants