Skip to content

Use a custom extension for File type#1420

Merged
carolynvs merged 2 commits intogetporter:mainfrom
carolynvs:file-type
Jan 19, 2021
Merged

Use a custom extension for File type#1420
carolynvs merged 2 commits intogetporter:mainfrom
carolynvs:file-type

Conversation

@carolynvs
Copy link
Copy Markdown
Member

@carolynvs carolynvs commented Jan 14, 2021

What does this change

Previously we had checks throughout the codebase checking if a parameter is Porter's special "file" type. Which lead to #1417 where porter explain shows the underlying string type for a file parameter instead of "file".

I have made the file type a custom extension under the porter namespace, and centralized the logic for the parameter type. I will submit this to the CNAB spec as a well-known extension since I think it is useful beyond Porter.

I also made our extension constants consistent.

What issue does it fix

Fixes #1417

Notes for the reviewer

Sorry this isn't split up into two commits! 😝

Checklist

  • Unit Tests
  • Documentation
  • Schema (porter.yaml)

If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

@carolynvs carolynvs changed the title Use a custom extension for File type WIP: Use a custom extension for File type Jan 14, 2021
@carolynvs carolynvs marked this pull request as draft January 14, 2021 22:44
@carolynvs carolynvs force-pushed the file-type branch 3 times, most recently from 11e66ad to cfd3700 Compare January 15, 2021 15:00
Previously we had checks throughout the codebase checking if a parameter
is Porter's special "file" type. Which lead to this bug.

I have made the file type a custom extension under the porter namespace,
and centralized the logic for the parameter type. I will submit this to
the CNAB spec as a well-known extension since I think it is useful
beyond Porter.

I also made our extension constants consistent.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@carolynvs carolynvs marked this pull request as ready for review January 15, 2021 19:47
@carolynvs carolynvs changed the title WIP: Use a custom extension for File type Use a custom extension for File type Jan 15, 2021
@carolynvs
Copy link
Copy Markdown
Member Author

@vdice This is now ready for review.

Copy link
Copy Markdown
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

So many improvements in this PR! Only a few comments/questions.

Comment thread pkg/cnab/extensions/dependencies_test.go Outdated
Comment thread pkg/cnab/extensions/extensions.go Outdated
Comment thread pkg/cnab/extensions/file_parameter.go Outdated
Comment thread pkg/cnab/extensions/file_parameter.go Outdated
Comment thread pkg/cnab/extensions/file_parameter.go Outdated
Comment thread pkg/cnab/extensions/dependencies_test.go Outdated
Comment thread pkg/cnab/extensions/dependencies_test.go Outdated
Comment thread pkg/porter/outputs.go Outdated
Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@carolynvs
Copy link
Copy Markdown
Member Author

I have created an issue to track the inconsistent spec around the dependencies key. Porter writes it has the fully io.cnab.dependencies and we shouldn't be matching on the shorthand as that can have false positives.

@carolynvs
Copy link
Copy Markdown
Member Author

Here's the PR to clarify the spec: cnabio/cnab-spec#404

Copy link
Copy Markdown
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

Porter explain shows string when the parameter is of type file

2 participants