Skip to content

feat(cli): json/yaml graph renderer#574

Merged
jakobmoellerdev merged 76 commits into
open-component-model:mainfrom
fabianburth:feat/json-or-yaml-tree-renderer
Aug 20, 2025
Merged

feat(cli): json/yaml graph renderer#574
jakobmoellerdev merged 76 commits into
open-component-model:mainfrom
fabianburth:feat/json-or-yaml-tree-renderer

Conversation

@fabianburth

@fabianburth fabianburth commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

This PR introduces a renderer for lists of objects, rendering them as json or yaml lists:

[
  "A",
  "B",
  "C",
  "D"
]
- A
- B
- C
- D

IMPORTANT:
This implementation would be a breaking change to ocm v1, where json or yaml lists were rendered as:

{
  "items": [
      "A",
      "B",
      "C",
      "D"
  ]
}
A
---
B
---
C
---
D

Considerations:

  • the first one makes it to be parsable more intuitively
  • the first one is the native json/yaml list marshaling

BUT
WILL DEFINITELY break workflows depending on the json or yaml output of the current CLI (if there are any).

It renames the package from renderer to render as it also defines general rendering utilities.
It defines CursorUp and EraseLine itself instead of using the one from the library to make the render package independent of the library.

Which issue(s) this PR fixes

Contributes to open-component-model/ocm-project#563

@github-actions github-actions Bot added kind/feature new feature, enhancement, improvement, extension size/l Large labels Aug 15, 2025
fabianburth and others added 28 commits August 18, 2025 15:25
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
…r handling

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Jakob Möller <jakob.moeller@sap.com>
…package structure and introduce options

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
…void func fields

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@fabianburth fabianburth force-pushed the feat/json-or-yaml-tree-renderer branch from f47bdce to a36dabc Compare August 19, 2025 09:53
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@fabianburth fabianburth marked this pull request as ready for review August 19, 2025 13:28
@fabianburth fabianburth requested a review from a team as a code owner August 19, 2025 13:28
@fabianburth fabianburth marked this pull request as draft August 19, 2025 13:39
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@fabianburth fabianburth marked this pull request as ready for review August 19, 2025 13:45
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@fabianburth fabianburth self-assigned this Aug 19, 2025

@jakobmoellerdev jakobmoellerdev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks neat!

Comment thread cli/internal/render/cmd.go
Comment thread cli/internal/render/graph/list/renderer.go
Comment thread cli/internal/render/graph/list/renderer.go Outdated
Comment thread cli/internal/render/graph/list/renderer.go Outdated
Comment thread cli/internal/render/graph/list/renderer_json_test.go Outdated
Comment thread cli/internal/render/graph/list/renderer_options.go Outdated
Comment thread cli/internal/render/graph/list/renderer_options.go Outdated
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
… while adding test case for idempotency

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@jakobmoellerdev jakobmoellerdev merged commit 536f38d into open-component-model:main Aug 20, 2025
17 checks passed
@jakobmoellerdev

Copy link
Copy Markdown
Member

super nice, cant wait to see it in action

@fabianburth fabianburth deleted the feat/json-or-yaml-tree-renderer branch August 20, 2025 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature new feature, enhancement, improvement, extension size/l Large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants