-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Allow means to disable or override rules of the Inflector #148
Comments
Good idea. Would you prefer to add overrides to the plugin config or have some extension property on an array (in the schema) that allows the singular/item name to be specified? I'd like to integrate as many of these exceptions as possible back into the inflector so that others can benefit from these when they're identified. For anyone looking for an immediate workaround, remember you can always use the javaType extension property override the class name chosen by the inflector. |
It's quite a rabbit hole - no automation will work 100% of the time (homonyms like 'bases' may be 'basis' or 'base'... based on intent) and adding all known exceptions would be crazy (do you include classic plurals like 'bretheren', 'kine', and 'stigmata'?) . Word-net could help, as long as js2p is run online, and that is still fallible in many common cases. Sometimes there is no "right" answer, when it comes down to personal preference or context (fish vs. fishes) The Project specific rules and exceptions get my vote. One could specify singular, plural, uncountable, and/or irregular values through the various configurations. I would expect most to use the simple irregular rule, but see no reason not to provide the others. An option to switch to a wordnet based inflector may or may not give better results, but would certainly preclude running offline. Unless that mechanism were extended to allow specifying ones own implementation, similar to annotationStyle and customAnnotator, but for inflection, I would look to the others first. |
I'm also having problems with the inflector, and would like to disable it, or wire in an inert version of the inflector interface through the configuration. |
@danieljue Which version of the plugin are you using? |
@joelittlejohn My apologies, I am using core 0.4.5. Just noticed that the latest stable is 0.4.7. Has this been addressed in that version? I am fond of using inflector helpers in other ways, it's just that this time it got in the way. ;-) |
@danieljue No problem. Someone else actually reported Address being singularized to Addres and this was fixed as #244. The fix went out in 0.4.6. |
rather than try to magically guess the correct singular, could we just append Item or Element (or some similar word).
it's not pretty, but it's always correct the biggest problem with the current magic is not the ugly mispellings [sic] but that the name changes depend on the content of the files, ie whether or not the content is an array, which makes automation difficult just adopt some deterministic rule and then users can "fix" things using heuristics and ad hoc rules if they choose to in my case, all my json sources end in _re (for requests) and _res (for responses) ... i couldn't figure out why half the generated source files were "missing" |
English has too many exceptions when converting between singular and plural for the Inflector to handle all cases. Even a smallish schema I ran through found multiple nouns that failed to be converted correctly (e.g. "curves" => "curf").
The text was updated successfully, but these errors were encountered: