Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Inflector #471

Merged
merged 1 commit into from
Mar 19, 2021
Merged

Remove Inflector #471

merged 1 commit into from
Mar 19, 2021

Conversation

kazk
Copy link
Member

@kazk kazk commented Mar 19, 2021

  • Use simple pluralizer (a Rust port of a popular JavaScript package plur minus the irregular and case matching)
  • Duplicate the code in kube-derive without the special casing because it's short enough and didn't want to make this public. If necessary, I can publish the version in kube-derive as a separate crate.

This may be a breaking change if a user is using some kind that results in different plural.

Closes #470.

- Use simple pluralizer
- Duplicate the code in `kube-derive`
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

awesome! looks clean, tests looks good.

@clux
Copy link
Member

clux commented Mar 19, 2021

not sure if this is worth a line in the CHANGELOG. It's another potential breaking change, but very unlikely.

@clux clux merged commit 8f2b5bd into kube-rs:master Mar 19, 2021
@kazk kazk deleted the remove-inflector branch March 19, 2021 23:26
@clux
Copy link
Member

clux commented Mar 19, 2021

Added some special cases from the upgraded dynamic_api example so it's now:

    if word == "endpoints" || word == "endpointslices" {
        return word.to_owned();
    } else if word == "nodemetrics" {
        return "nodes".to_owned();
    } else if word == "podmetrics" {
        return "pods".to_owned();
    }

@kazk
Copy link
Member Author

kazk commented Mar 20, 2021

I didn't see EndpointSlices kind in swagger.json. It had EndpointSlice kind and endpointslices path which I included in the test. Inflector failed that because of a buggy regex producing endpointsliceice. See https://github.com/whatisinternet/Inflector/pull/73/files#diff-fe8b9a2affc38f7fe10a95dc94e6e47ad21487ff46e2aea9aea8573604d9730eL45

@clux
Copy link
Member

clux commented Mar 31, 2021

Released in 0.52.0 \o/

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.

Remove Inflector
2 participants