Open Fabiencdp opened 2 years ago
I can make a merge request to fix this if you're interested.
I saw two options :
1 - Forcing the tags
property of Operation class to be lowercase in the constructor.
2 - Detect service.fileName
duplicates in the generate
method of NgOpenApiGen class, and add a suffix "service-name-X.service" (where X = number of duplicates)
The first could be more clean but i didn't check all the code.
It would be great if you could contribute a PR.
Option 1 would be the way to go, but not lowercasing the entire tag, as it could be something like MyService
, which would generate the a service with the same casing. I think that lowercasing the first character would be the way to go in this case.
here is it:
I also edited the "all-operation" test spec file to validate the change. Feel free to tell me if the code is not suitable.
EDIT This PR only fix partially the tag typo problem, example:
But if you make a typo like this:
Because the script that write the service files will try to write two file with the same name, so only one is generated at end. Hope it's clear enough.
After releasing in 0.21.0, I noticed there were broker clients, so I reverted the commit. To be honest, a typo is an error, and shouldn't be handled at generator-level - If you make such typo in code, it won't compile or give you runtime errors.
Hi,
I just noticed some strange problem with tags. With the below simplified spec, notice the difference about the tag case (Export vs export) :
When running the generator with this example, you will get the following service ts file :
Result a missing method (operationId ExportListGet).
If you set both tag to lower case (or any matching case), the issue is solved and the two methods are generated in one service file. If you set two completely different tags, two services are generated, that seems to be coherent.
The issue append with the version 0.19.4. I didn't tried other versions.