Skip to content

Conversation

@gusfcarvalho
Copy link
Contributor

No description provided.

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Copilot AI review requested due to automatic review settings January 23, 2026 09:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request modifies the CreateCapabilities endpoint to handle a single capability instead of an array of capabilities. The change simplifies the endpoint from batch processing to single-item creation.

Changes:

  • Modified request binding from array ([]oscalTypes_1_1_3.Capability) to single capability (oscalTypes_1_1_3.Capability)
  • Changed validation logic to validate a single capability instead of iterating over an array
  • Simplified relational model conversion to handle one capability instead of multiple
  • Changed response type from GenericDataListResponse to GenericDataResponse

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1637 to +1640
relationalCapability := relational.Capability{}
relationalCapability.UnmarshalOscal(capability)
relationalCapability.ComponentDefinitionId = id
newCapability = relationalCapability
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The redundant variable assignment is unnecessary. The variable 'newCapability' is declared on line 1636, then 'relationalCapability' is created on line 1637, populated on lines 1638-1639, and then assigned to 'newCapability' on line 1640. You can simplify this by using 'newCapability' directly instead of creating an intermediate 'relationalCapability' variable.

Suggested change
relationalCapability := relational.Capability{}
relationalCapability.UnmarshalOscal(capability)
relationalCapability.ComponentDefinitionId = id
newCapability = relationalCapability
newCapability.UnmarshalOscal(capability)
newCapability.ComponentDefinitionId = id

Copilot uses AI. Check for mistakes.
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
@gusfcarvalho
Copy link
Contributor Author

actually - we don;t need this to fix the issue. Better to establish routes in api are batch - first.

@gusfcarvalho gusfcarvalho deleted the gc-fix-capabilities-creation branch January 23, 2026 10:02
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.

2 participants