-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: add FileWithMetadata type to the core #110
Conversation
e5a8175
to
68236de
Compare
@dpopp07 Just noticed the builds for this PR failed due to the use of the testing.T.TempDir() function. That was apparently introduced in Go 1.15 and the minimum version of Go that we currently support in the core and SDKs is 1.12. Is there an alternative that you can use instead??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except for the TempDir() issue :)
v5/core/file_with_metadata_test.go
Outdated
var err error | ||
|
||
// setup the test by creating a temp file for the unmarshaler to read | ||
tempdir := t.TempDir() // this is automatically cleaned up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to code around the fact that TempDir() is not present until Go 1.15, but we currently support Go 1.12+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah rats, I didn't notice that. I didn't realize I had Go 1.15 locally either but I guess I do. I can go back to what I was doing before I found that function and create my own temp dir
7a2a858
to
b990571
Compare
FileWithMetadata is a struct that contains the binary data within a file, along with specific metadata: the filename and the content type. This is a type that the generated code occasionally uses. Currently, we generate this type as a model on a specific service but because it is service-independent, we want to move it to the core. This adds it as a supported type within the core. Although the generator won't be able to change this type in options models until the next major relase, it will use this type in the generated unmarshall functions, which are currently broken. This will be fixed in the generator after this feature is released. The new "unmarshaler" in the core includes code to parse the JSON string and read the data from the file while creating the struct. Generated unmarshaller on service structs will invoke this new, working unmarshaller.
b990571
to
6b80cb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🎉 This PR is included in version 5.4.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
FileWithMetadata is a struct that contains the binary data within a file, along
with specific metadata: the filename and the content type. This is a type that
the generated code occasionally uses. Currently, we generate this type as a
model on a specific service but because it is service-independent, we want to
move it to the core. This adds it as a supported type within the core. Although
the generator won't be able to change this type in options models until the next
major relase, it will use this type in the generated unmarshall functions, which
are currently broken. This will be fixed in the generator after this feature is
released.
The new "unmarshaler" in the core includes code to parse the JSON
string and read the data from the file while creating the struct. Generated
unmarshaller on service structs will invoke this new, working unmarshaller.
I have verified that this works and this PR will be a necessary dependency of my upcoming generator PR.