Skip to content

fix: class-generator --update-schema misses duplicate kinds across API groups #2666

@myakove

Description

@myakove

Problem

When multiple CRDs share the same kind (e.g., Backup exists in both velero.io and postgresql.cnpg.noobaa.io), the class-generator has no way to let the user specify which API group they want. Running class-generator -k Backup may generate the wrong one.

Current Behavior

  • class-generator -k Backup --dry-run generates for an unintended API group
  • class-generator -k backups.velero.io --dry-run fails because -k only accepts kind names
  • No --api-group or similar option exists to disambiguate
  • After --update-schema, the mapping may not even contain the kind, yet it still picks one

Expected Behavior

Users should be able to specify which API group to use when a kind exists in multiple groups.

Reported in

#2654 (comment)

Requirements

  • Add support for specifying API group when kind is ambiguous (e.g., --api-group velero.io or -k Backup.velero.io)
  • When multiple API groups exist for the same kind and no group is specified, prompt the user to choose
  • Update help text and documentation

Deliverables

  • CLI option for API group selection
  • Interactive prompt when kind is ambiguous
  • Tests for disambiguation logic
  • Updated CLI help text

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions