Open osery opened 4 years ago
The splitting logic that we use is here:
https://github.com/go-openapi/swag/blob/master/name_lexem.go https://github.com/go-openapi/swag/blob/master/split.go
I think we try to detect that list of blessed acronyms and use that as an input to the word splitter
Thank you for the quick response :pray:.
My issue is really just with the initialisms in plural, i.e., with the ending "s", e.g., IDs
, IPs
, etc. This results in go modules (and files) named i_ds
and i_ps
which seems wrong. At the same time, trying to solve this in general is likely to produce other issues. So I was thinking that there could be an option to add a list of mapping overrides saying, e.g., map IDs
to ids
or such.
I am happy to try solving in general (or at least for names that are exactly an initialism + "s", not their further composition). Thoughts?
@osery you may use the AddInitialisms()
func for that.
@fredbi not really. AddInitialisms()
only handles the singular case (e.g., VPC
-> vpc
) but not the plural (e.g., VPCs
-> vpcs
and results in v_p_cs
instead).
I have a name that is a plural of an initialism (e.g.,
IDs
) in my swagger file. Filename generated out of this name isi_ds
, where I would ideally expectids
.I understand this is hard to solve perfectly for each use case in general. Any ideas how to at least enforce an override for a specific names? I am happy to contribute a PR if we agree on the best approach.
Many thanks :pray:.