Skip to content

feat: differentiate simple/advanced API for fabrica payloads - #131

Open
synackd wants to merge 1 commit into
mainfrom
feat/advanced-payload-api
Open

feat: differentiate simple/advanced API for fabrica payloads#131
synackd wants to merge 1 commit into
mainfrom
feat/advanced-payload-api

Conversation

@synackd

@synackd synackd commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Description

Implement API changes from OpenCHAMI/fabrica#64.

Add --envelope flag to fabrica resource commands to allow the user to specify additional metadata that envelops the spec, which contains the actual data. By default (without --envelope), the payload is just the spec and additional metadata is ignored.

Fixes #115

Checklist

  • My code follows the style guidelines of this project
  • I have added/updated comments where needed
  • I have added tests that prove my fix is effective or my feature works
  • I have run make test (or equivalent) locally and all tests pass
  • I have updated the relevant documentation (CLI examples, man pages, README, other docs, etc.)
  • DCO Sign-off: All commits are signed off (git commit -s) with my real name and email
  • REUSE Compliance:
    • Each new/modified source file has SPDX copyright and license headers
    • Any non-commentable files include a <filename>.license sidecar
    • All referenced licenses are present in the LICENSES/ directory

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Dependency update

For more info, see Contributing Guidelines.

Implement API changes from OpenCHAMI/fabrica#64.

Add --envelope flag to fabrica resource commands to allow the user to
specify additional metadata that envelops the spec, which contains the
actual data. By default (without --envelope), the payload is just the
spec and additional metadata is ignored.

Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
@synackd synackd added the needs testing Needs more testing before approval label Jul 29, 2026
Comment thread cmd/boot/bmc/add.go
@@ -27,38 +29,67 @@ See ochami-boot(1) for more details.`,
Example: ` # Add BMC using payload data
ochami boot bmc add -d \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't we have -e for the full envelope here?

Comment thread cmd/boot/bmc/add.go
}'

# Add multiple BMCs using payload data
ochami boot bmc add -d \

@davidallendj davidallendj Jul 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as line 28 with the -e flag unless I'm misunderstanding how the bulk add works.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The new API requires a "name" to be passed for each item when using *Simple() functions.

In the generated CLI (which doesn't support bulk add), this is passed as a positional argument.

In the ochami CLI, it made sense to include this within the payload structure so that bulk items could be added without complicated positional argument handling. The current implementation puts that in metadata.name, since there's a field for that already in the metadata block. However, I can see the potential confusion of having to pass metadata without using -e, so I'm wondering what the best way of handling this is.

One way is to use a top-level name field in the simple API payload and note that in the documentation. Then, for the advanced API, the metadata.name field would be used.

I don't see the above to be a problem, but open to thoughts.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess that would work. I just expected -e for advanced and no flag without out and if the required metadata.name isn't there, then it would return an error.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, name is required so perhaps adding it as a required, top-level field in the payload the CLI reads makes sense then.

@synackd

synackd commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator Author

I need to refactor this a bit due to some potential confusion arising from the current simple-vs-advanced API data structure (see https://github.com/OpenCHAMI/ochami/pull/131/changes/BASE..ee8d4d1a4457f7c7ee1fe2d1126bcc2fe5bfd303#r3676368580).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs testing Needs more testing before approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DEV] Update service deps and CLI docs for new data format

2 participants