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

Added YAML en(de)coding support to MessageCard #169

Merged
merged 1 commit into from Jun 29, 2022

Conversation

pcanilho
Copy link

Current (non-)issue

I am planning to use this library with pre-built templates, provided by users, in YAML format. Due to the type of the ValidateFunc field of MessageCard, YAML decoding/encoding doesn't work out-of-the-box since the marshaller attempts to parse that field.

	// ValidateFunc is an optional user-specified validation function that is
	// responsible for validating a MessageCard. If not specified, default
	// validation is performed.
	ValidateFunc func() error `json:"-"`

Furthermore, other fields such as Type and Context require that an extra @ symbol is prefixed when encoding its value. Without effectively providing YAML tags, this is not feasible without re-implementing the structs in the client side.

Goal

With this PR, clients of this library will be able to decode/encode the structs found within the messagecards.go file into YAML format out-of-the-box with no impact to existing usage.

Impact

No impact is expected since no new libraries need to be included in this library nor does the inclusion of new tags affect the overall behaviour of the codebase.

… from and to YAML files when clients require it
@pcanilho pcanilho changed the title feat: added 'yaml' tags to the [messagecard] structs Added YAML en(de)coding support to MessageCard Jun 28, 2022
@atc0005
Copy link
Owner

atc0005 commented Jun 28, 2022

@pcanilho Thank you for submitting this PR.

I'll look over it and get back to you when I can. It may be a few days before you hear from me.

The linter errors are for existing changes (my fault), so please disregard them.

@atc0005 atc0005 self-assigned this Jun 29, 2022
@atc0005 atc0005 self-requested a review June 29, 2022 09:51
@atc0005 atc0005 added this to the v2.7.0 milestone Jun 29, 2022
@atc0005 atc0005 added the enhancement New feature or request label Jun 29, 2022
@atc0005
Copy link
Owner

atc0005 commented Jun 29, 2022

@pcanilho Thank you again for submitting this PR.

There are some further cleanup tasks I'd like to have applied before the next stable release, but I'll go ahead and tag another alpha release in case you want to reference your changes (e.g., go.mod) in the meantime.

No timeline on the next stable release, but I'm hoping for sooner rather than later.

@atc0005 atc0005 merged commit 1a8d046 into atc0005:master Jun 29, 2022
@pcanilho
Copy link
Author

Hi @atc0005 ,
Thank you for your prompt responses and for the new tag creation, this is deeply appreciated as it unblocks me. 🙂

@atc0005 atc0005 added the card format/messagecard MessageCard (aka, "legacy actionable message card") support label Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
card format/messagecard MessageCard (aka, "legacy actionable message card") support enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants