Bug Report Checklist
Description
I am working with the Microsoft Graph API specification (although I used yq -o=json eval openapi.yaml > openapi.json to convert to a JSON spec first, since there are too many Yaml code points for swagger-parser in v6.5.0 of openapi-generator). It has models named in the following format:
microsoft.graph.user
microsoft.graph.authenticationMethod
microsoft.graph.fido2AuthenticationMethod
etc. The Rust client generator is outputting the following warnings:
[main] WARN o.o.c.languages.AbstractRustCodegen - MicrosoftGraphFido2AuthenticationMethod cannot be used as a model name. Renamed to MicrosoftPeriodGraphPeriodFido2AuthenticationMethod
[main] WARN o.o.c.languages.AbstractRustCodegen - microsoft/graph/fido2_authentication_method cannot be used as a model file name. Renamed to microsoft_period_graph_period_fido2_authentication_method
This output is perplexing, as MicrosoftGraphFido2AuthenticationMethod post-sanitizing is completely legitimate for Rust, but it still performs another pass and adds Period in placements where . is in the original model name.
Likewise, the module file pathing microsoft/graph/fido2_authentication_method would be perfectly legitimate (assuming proper supporting mod.rs files were generated along the path) as a module path and file name. Or if not that microsoft_graph_fido2_authentication_method would be perfectly good as well, without the added _period separator in the module path name.
I realize these may be two separate issues, but since Period and _period are likely rooted with the same failing to handle . delimited model names, I bet they can be solved together.
openapi-generator version
6.5.0
OpenAPI declaration file content or url
https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml
converted to json with:
yq -o=json eval openapi.yaml > openapi.json
Generation Details
openapi-generator generate -g rust \
-i openapi.json \
-o ms-graph-rust \
--additional-properties=useSingleRequestParameter=true \
--skip-validate-spec
Steps to reproduce
- Download the openapi.yaml spec.
- Convert to openapi.json spec.
- Run the above command, see all of the WARN output.
Suggest a fix
I briefly reviewed the AbstractRustCodegen class and how its calling down into DefaultCodegen for various name sanitizing and character replacement, but didn't dig very deep. I feel like the owner of AbstractRustCodegen will know of a good way to handle this issue immediately after reading this description.
Bug Report Checklist
Description
I am working with the Microsoft Graph API specification (although I used
yq -o=json eval openapi.yaml > openapi.jsonto convert to a JSON spec first, since there are too many Yaml code points for swagger-parser in v6.5.0 of openapi-generator). It has models named in the following format:microsoft.graph.usermicrosoft.graph.authenticationMethodmicrosoft.graph.fido2AuthenticationMethodetc. The Rust client generator is outputting the following warnings:
This output is perplexing, as
MicrosoftGraphFido2AuthenticationMethodpost-sanitizing is completely legitimate for Rust, but it still performs another pass and addsPeriodin placements where.is in the original model name.Likewise, the module file pathing
microsoft/graph/fido2_authentication_methodwould be perfectly legitimate (assuming proper supportingmod.rsfiles were generated along the path) as a module path and file name. Or if not thatmicrosoft_graph_fido2_authentication_methodwould be perfectly good as well, without the added_periodseparator in the module path name.I realize these may be two separate issues, but since
Periodand_periodare likely rooted with the same failing to handle.delimited model names, I bet they can be solved together.openapi-generator version
6.5.0
OpenAPI declaration file content or url
https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml
converted to json with:
Generation Details
Steps to reproduce
Suggest a fix
I briefly reviewed the AbstractRustCodegen class and how its calling down into DefaultCodegen for various name sanitizing and character replacement, but didn't dig very deep. I feel like the owner of AbstractRustCodegen will know of a good way to handle this issue immediately after reading this description.