-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
Using Meta to Specify time.Time Type Causes Code Generation Error #3595
Comments
Hello, the type specified with |
@raphael Thank you for your reply. According to the documentation, the The error occurs because the validation code generated by My goal is to use time.Time directly in Go and to include format: date-time in the API specification. |
The goal makes sense, it won't work out of the box though as Goa can't possibly know how to convert any type to any other type. |
I'm considering this feature. |
Description
In my design file, I use the following code to specify a
date-time
format field astime.Time
type:The reason for writing it this way is to avoid repeatedly converting between time.Time and string.
However, the generated code produces the following error:
cannot use *body.Timestamp (variable of type time.Time) as string value in argument to goa.ValidateFormat
Example
Below is the complete design file example:
Expected Solution
I hope to be able to specify a date-time format field as time.Time type in the design file using Meta, and have the generated code work without the above error.
Additional Information
goa version: v3.16.2
Golang version: go1.22.6
Operating System: linux/arm64
I would appreciate any solutions or guidance. Thank you!
The text was updated successfully, but these errors were encountered: