Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow numbers and booleans to be expressed as strings #22

Merged
Merged
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
44 changes: 41 additions & 3 deletions pkg/fftypes/ffi_param_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,30 @@ func (v *BaseFFIParamValidator) GetMetaSchema() *jsonschema.Schema {
}
}
},
"numberTypeOptions": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"number",
"string"
]
}
}
},
"booleanTypeOptions": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"boolean",
"string"
]
}
}
},
"ffiParam": {
"oneOf": [
{
Expand All @@ -68,9 +92,23 @@ func (v *BaseFFIParamValidator) GetMetaSchema() *jsonschema.Schema {
"properties": {
"oneOf": {
"type": "array",
Copy link
Contributor

Choose a reason for hiding this comment

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

@nguyer explained to me that this is a short-cut, where the "type": "array" is factored out of the entries from the "oneOf" array, such that it applies to all of them

"items": {
"$ref": "#/$defs/integerTypeOptions"
}
"oneOf": [
{
"items": {
"$ref": "#/$defs/integerTypeOptions"
}
},
{
"items": {
"$ref": "#/$defs/numberTypeOptions"
}
},
{
"items": {
"$ref": "#/$defs/booleanTypeOptions"
}
}
]
}
},
"required": [
Expand Down