Skip to content

Remove redundant status: enabled from generated components#951

Open
BasavarajBankolli wants to merge 2 commits intomeshery:masterfrom
BasavarajBankolli:fixes/model-gen-json
Open

Remove redundant status: enabled from generated components#951
BasavarajBankolli wants to merge 2 commits intomeshery:masterfrom
BasavarajBankolli:fixes/model-gen-json

Conversation

@BasavarajBankolli
Copy link
Copy Markdown

Description

This PR fixes 17918

Previously, generated component definitions included "status": "enabled" by default. Since "enabled" is already the implicit default behavior, explicitly including it results in redundant data.

This PR updates the model generation logic in MeshKit to:

  • Avoid assigning "status": "enabled" by default
  • Only include the status field when it is explicitly set to a non-default value (e.g., "ignored")

Notes for Reviewers

  • Updated logic in registry/component.go and registry/model.go to prevent default status injection.
  • Ensured that status is only assigned when required.
  • Verified that generated component definitions no longer include "status": "enabled".
  • No changes to behavior when status is explicitly set (e.g., "ignored" remains unaffected).

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Basavaraj PB <basavarajbankolli76@gmail.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the component status assignment logic within the registry. In registry/component.go, local status variable initializations were removed, which may result in undefined variable errors during compilation. In registry/model.go, the logic was updated to use a pointer-based approach for _status, ensuring it is only applied to the component definition when the model is not published. I have no feedback to provide.

Copy link
Copy Markdown

@Siddhi-sahu Siddhi-sahu left a comment

Choose a reason for hiding this comment

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

hi @BasavarajBankolli, did you validate the changes through the cli? if yes can you please attach screenshots.

Signed-off-by: Basavaraj PB <basavarajbankolli76@gmail.com>
@BasavarajBankolli
Copy link
Copy Markdown
Author

Hi @Siddhi-sahu ,

I’ve validated the changes locally by linking my modified meshkit and regenerating models.
Key observations:

image
  1. In model.json:

    • "status" is now empty ("") instead of defaulting to "enabled"
  2. In component definition:

    • "status" is null, confirming that component status is no longer redundantly inherited from the model

validate

This confirms that redundant status propagation has been removed and defaults are handled correctly.
Please find the attached screenshots highlighting these changes.

Thank you

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.

Model Generator includes status: enabled unnecessarily

2 participants