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

ref(bundle/*): replace mapstructure tags with yaml tags #95

Merged
merged 1 commit into from Aug 9, 2019

Conversation

vdice
Copy link
Member

@vdice vdice commented Aug 8, 2019

Represents a possible dual closing of #91 and adding yaml tags to all of the structs (per recent history of third-party use in #90 and #92; 92 could/would be superseded by this PR.)

@jeremyrickard
Copy link
Member

Do we need the YAML? The spec only really supports JSON for the bundle metadata right?

Is this for downstream use by Porter?

bundle/bundle.go Outdated Show resolved Hide resolved
bundle/bundle.go Outdated Show resolved Hide resolved
bundle/bundle.go Outdated Show resolved Hide resolved
@vdice
Copy link
Member Author

vdice commented Aug 9, 2019

Do we need the YAML? The spec only really supports JSON for the bundle metadata right?

It's true, an argument can be made that yaml tags shouldn't be in (similar w/ mapstructure) b/c cnab-go itself doesn't (un)marshal yaml. However, indeed, there is one current use of a third-party (Porter) benefiting from having yaml tags, as it enables us to easily unmarshal from yaml definitions into these canonical golang structs.

Definitely open to suggestions on other routes to achieve the same goal of third-party consumers wishing to re-use these canonical golang structs but may be unmarshaling from representations other than JSON.

@vdice vdice force-pushed the ref/rm-mapstructure-add-yaml branch from b2b3c7a to cac56cd Compare August 9, 2019 15:09
@jeremyrickard
Copy link
Member

I'm fine with adding the YAML, it makes things more flexible for downstream consumers.

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

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

I'm fine with adding YAML too, LGTM !

Copy link
Member

@jeremyrickard jeremyrickard left a comment

Choose a reason for hiding this comment

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

LGTM

@jeremyrickard jeremyrickard merged commit c992a16 into cnabio:master Aug 9, 2019
@vdice vdice deleted the ref/rm-mapstructure-add-yaml branch August 9, 2019 16:19
@glyn
Copy link
Contributor

glyn commented Aug 12, 2019

If we ever need to revisit the decision to support YAML tags, we might want to try converting from YAML to JSON and then reusing the JSON tags for demarshalling as in this article.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants