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

🐛 Add format for float types #566

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions pkg/crd/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ func builtinToType(basic *types.Basic, allowDangerousTypes bool) (typ string, fo
format = "int32"
case types.Int64, types.Uint64:
format = "int64"
case types.Float32:
format = "float"
case types.Float64, types.UntypedFloat:
format = "double"
Copy link
Member

Choose a reason for hiding this comment

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

Hi @tamalsaha,

That is nice. But did you check the comment on top of this method? See:

// builtinToType converts builtin basic types to their equivalent JSON schema form.
// It *only* handles types allowed by the kubernetes API standards. Floats are not
// allowed unless allowDangerousTypes is true

In this way, I understand that we cannot add the floats here.

}

return typ, format, nil
Expand Down