refactor: extract inspect rendering logic to be display handlers#1150
refactor: extract inspect rendering logic to be display handlers#1150JeyJeyGao merged 32 commits intonotaryproject:mainfrom
Conversation
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1150 +/- ##
==========================================
+ Coverage 73.30% 74.70% +1.40%
==========================================
Files 53 59 +6
Lines 3240 3337 +97
==========================================
+ Hits 2375 2493 +118
+ Misses 671 651 -20
+ Partials 194 193 -1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
shizhMSFT
left a comment
There was a problem hiding this comment.
I noticed that handlers are grouped by command names instead of format types. Although both are acceptable, grouping by format types can have more benefits in the long run, especially we have growing commands but fixed set of format types.
One important point is that grouping by format types make developers easier to have consistent output for a certain format type across all commands.
Also, it is easier to have common utility functions without creating a utility package, which is discouraged.
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Updated to group the handlers by format types. |
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
…aryproject#1150) Depends on spec change: notaryproject#1156 Refactor: - Extract output formatting logic from the inspect command layer to an isolated display handler layer for processing rendering. - Add `json` and `tree` inspect handlers. Fix: - For `tree` output, make the key names with multiple words separated by space characters rather than capitalizing the words, which is defined in the [inspect command spec](https://github.com/notaryproject/notation/blob/v1.2.0/specs/commandline/inspect.md#inspect-signatures-on-the-supplied-oci-artifact-identified-by-the-digest). - For `json` output, default to rendering time in RFC3339 with nanoseconds (Notation expiry, signing time and certificate expiry are accurate to 1 second. Timestamp [RFC 3161](https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2) can have fraction-of-second time value). E2E Test: - inspect signature with timestamp, signature expiry and user metadata (text, json) - inspect signatures with invalid timestamp (test, json) - inspect with `-o` shorthand. Resolves part of notaryproject#1151 --------- Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
…aryproject#1150) Depends on spec change: notaryproject#1156 Refactor: - Extract output formatting logic from the inspect command layer to an isolated display handler layer for processing rendering. - Add `json` and `tree` inspect handlers. Fix: - For `tree` output, make the key names with multiple words separated by space characters rather than capitalizing the words, which is defined in the [inspect command spec](https://github.com/notaryproject/notation/blob/v1.2.0/specs/commandline/inspect.md#inspect-signatures-on-the-supplied-oci-artifact-identified-by-the-digest). - For `json` output, default to rendering time in RFC3339 with nanoseconds (Notation expiry, signing time and certificate expiry are accurate to 1 second. Timestamp [RFC 3161](https://www.rfc-editor.org/rfc/rfc3161#section-2.4.2) can have fraction-of-second time value). E2E Test: - inspect signature with timestamp, signature expiry and user metadata (text, json) - inspect signatures with invalid timestamp (test, json) - inspect with `-o` shorthand. Resolves part of notaryproject#1151 --------- Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
Depends on spec change: #1156
Refactor:
jsonandtreeinspect handlers.Fix:
treeoutput, make the key names with multiple words separated by space characters rather than capitalizing the words, which is defined in the inspect command spec.jsonoutput, default to rendering time in RFC3339 with nanoseconds (Notation expiry, signing time and certificate expiry are accurate to 1 second. Timestamp RFC 3161 can have fraction-of-second time value).E2E Test:
-oshorthand.Resolves part of #1151