Skip to content

@W-21045342 Fix: Agent codegenie icon not showing in compact AMF models#82

Merged
alexpmule merged 3 commits intomasterfrom
W-21045342/Add-Agent-Topic-icon-on-operations
Jan 28, 2026
Merged

@W-21045342 Fix: Agent codegenie icon not showing in compact AMF models#82
alexpmule merged 3 commits intomasterfrom
W-21045342/Add-Agent-Topic-icon-on-operations

Conversation

@alexpmule
Copy link
Contributor

@alexpmule alexpmule commented Jan 28, 2026

Enhance AmfHelperMixin with new utility methods for model target retrieval and property searching

  • Added _getRootModelTargets method to normalize root model targets for searching in compact models.
  • Introduced _findPropertyByKeys method to search for properties by multiple keys in target nodes.
  • Updated TypeScript definitions to include the new methods and improved documentation for existing methods.

Problem

The agent codegenie icon was not displaying for operations in api-summary component when loading compact AMF specifications. This occurred because AmfHelperMixin methods (_computeAgents, _computeNodeAgent) were not correctly resolving custom domain properties in compact models where:

  1. Custom domain properties are stored in the root AMF model, not in the operation node
  2. Intermediate nodes may have their own customDomainProperties pointing to other nodes (as explained by AMF developers)
  3. Property references use IDs like #10 but are stored under keys like amf://id#10

Solution

Enhanced AmfHelperMixin to properly handle compact models by:

1. Recursive Navigation (_findCustomDomainPropertyByKey)

  • Added recursive navigation through intermediate nodes that may have their own customDomainProperties
  • Implemented cycle detection using visited IDs to prevent infinite loops
  • Searches both in the provided node and in the root AMF model

2. Root Model Resolution (_resolveCustomDomainProperty)

  • Enhanced to search in root model when property is not found in the provided node
  • Handles both array and single-object root models (compact format)

3. Code Refactoring

  • Created _getRootModelTargets() helper method to normalize root model access
  • Created _findPropertyByKeys() helper method to search properties by multiple key formats
  • Reduced code duplication and improved maintainability

Changes

  • src/AmfHelperMixin.js: Enhanced custom domain property resolution methods
  • src/AmfHelperMixin.d.ts: Updated type definitions

Testing

  • ✅ Works with both expanded and compact AMF models
  • ✅ Handles intermediate nodes with nested customDomainProperties
  • ✅ Prevents infinite loops in recursive navigation
  • ✅ Maintains backward compatibility
Screenshot 2026-01-28 at 12 35 02 AM

Related

Fixes issue where agent codegenie icon was not displayed in api-summary component for compact specs.

…ieval and property searching

- Added `_getRootModelTargets` method to normalize root model targets for searching in compact models.
- Introduced `_findPropertyByKeys` method to search for properties by multiple keys in target nodes.
- Updated TypeScript definitions to include the new methods and improved documentation for existing methods.
@alexpmule alexpmule changed the title Fix: Agent codegenie icon not showing in compact AMF models @W-21045342 Fix: Agent codegenie icon not showing in compact AMF models Jan 28, 2026
@alexpmule alexpmule self-assigned this Jan 28, 2026
- Added tests for the new 'Compact model V1' to validate agent and topic metadata computations.
- Updated existing tests to ensure compatibility with compact models by setting the `amf` property on the element.
- Introduced operation-level agent detection tests to verify agent handling in operation nodes.
- Improved assertions to check for defined web API outputs across various test cases.
@alexpmule alexpmule merged commit e489ed4 into master Jan 28, 2026
4 checks passed
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.

3 participants