Update Arg for specs to use interface{} instead of string#192
Open
Update Arg for specs to use interface{} instead of string#192
Arg for specs to use interface{} instead of string#192Conversation
Currently the `Arg` struct for spec arguments parses argument values in the spec as `string` types. This causes some pain for jobs that are running using values directly from the spec as they cannot be defined using more meaningful types (e.g. `int` or `bool`) and instead must expect values to be strings. Changing this to use `interface{}` allows values to be parsed by the yaml parser into primitives based on the content of the yaml file rather than forcing everything to be strings.
daniel-nichter
approved these changes
Aug 10, 2023
Contributor
daniel-nichter
left a comment
There was a problem hiding this comment.
Talked with @Areson and this should be ok in Spin Cycle itself since the Job method is already Create(jobArgs map[string]interface{}). However, it could be a breaking change in users' jobs if a job presumes string types. Now jobs need to "dereference" the interface{} to its real underlying type. So I suggest a new minor version for this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the
Argstruct for spec arguments parses argument values in the spec asstringtypes. This causes some pain for jobs that are running using values directly from the spec as they cannot be defined using more meaningful types (e.g.intorbool) and instead must expect values to be strings. Changing this to useinterface{}allows values to be parsed by the yaml parser into primitives based on the content of the yaml file rather than forcing everything to be strings.