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

Array properties that include the word "men" in the name result in incorrectly named item class #142

Closed
pphillips-techphob opened this issue Jan 31, 2014 · 1 comment
Milestone

Comments

@pphillips-techphob
Copy link

The food ratings agency api (http://api.ratings.food.gov.uk/Help/Api/GET-Establishments-basic) generates JSON of the form:

{
  "establishments": [
    {
      "FHRSID": 1
    }
  ]
}

The generator then creates a Java class called Establishmants.java with an a rather than an e in ments. Not a big issue as I can then do a global search and replace on the generated code, but it would be good to be able to turn it off.

@joelittlejohn
Copy link
Owner

It looks like this is a bug in the inflector. We're trying to make a singular noun from the word 'establishments', and the result should clearly be 'establishment' but in fact this:

new Inflector().singularize("establishments")

returns

"establishmants"

There's a rule in the inflector which turns 'men' into 'man' (e.g. the singular of 'postmen' is 'postman'). I expect the rule needs to be adjusted so that 'men/man' need to be found at the end of the word for that rule to apply. Or, if that's not possible, we can remove the men/man rule entirely.

Thanks for raising this. Unfortunately I can't think of a workaround at the moment.

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

No branches or pull requests

2 participants