ManageIQ/kubeclient

Word breaking fails for kind `APIService`

cben opened this issue · 1 comments

cben commented

It gets method names like get_apiservice, get_apiservices.

  • The updated algorithm on master branch correctly splits underscore_entity("APIService") -> "api_service".
  • However, parse_definition computes prefix it can match against the given lowercase plural, up to the last capital letter.
    • Normally you get e.g. "NetworkP" + "olicy"/"olicies" -> "network_p" + "olicy"/"olicies".
    • But when prefix is all uppercase e.g. "APIS", we compute underscore_entity("APIS") -> "apis", to which we append "ervice"/"ervices" to construct "apiservice", "apiservices" ☹️

We have all the information here that "Service" is a separate word, but we're not passing it into underscore_entity. 🤔

cben commented

Funnily enough, this was the motivating case for the original change #355, but all the pretty tables where I listed it as changed there were based on testing underscore_entity and not the actual method names produced by parse_definition 😳

  • EDIT: there were several PRs touching this code area around same time, so it's possible this worked originally and got lost later in rebases? Anyway, the incomplete test coverage is what allowed this.

FYI @eatwithforks

I have an idea how to fix this by passing whole kind to parse_definition, but need to see if it will work out...