Skip to content

Business logic to act as API layer?Β #5317

@dharmit

Description

@dharmit

This was originally discussed on #5293 (comment).

odo has a few gaps when it comes to JSON output. To be specific, the outputs are inconsistent at few places, incomplete at other, and overall unreliable as we keep changing things. Sometimes even between patch releases (z stream).

Part of this is attributed to not having API documentation and design; we keep adding/modifying/removing things as it dims fit to us at CLI level without much thought into how it would impact tooling created on top of odo. Another reason for this problem is that we never had, what @feloy described as, a "contract" that gave an idea about what to expect in terms of JSON output for various commands.

As mentioned in the original discussion linked above and conversation with @deboer-tim, we should return structs from the business logic layer such that:

  • if the CLI user requested JSON output, the CLI layer could simply marshal these structs into JSON
  • if the CLI user requested human-readable output, CLI layer could use these structs to construct one

Maybe getting too optimistic here, but this could also make odo usable as a library instead of just CLI.

/kind discussion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done βœ…

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions