-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
Poem/Openapi : Strategy for generating generic structure names #774
Comments
Currently it is not possible to customize the OpenAPI name corresponding to a generic type. If you need a legal name, you can only avoid using generics. |
I have a proposition, fn name() -> Cow<'static, str> {
format!("[{}]", T::name()).into()
} to fn name() -> Cow<'static, str> {
format!(get_vec_gen_template(), T::name()).into()
} |
#318 and #670 are about similar problems. The current output is non-compliant with the OpenAPI spec, even if SwaggerUI & Co don't complain:
(https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object) The problem I see with both your suggestion (Prefix with @sunli829 would you be open to a PR that removes the disallowed characters, and if so, do you have a preference for the format (i.e., replace punctuation with underscores, Prefix with a String like "Of", ...)? |
Hello, @amtelekom if we make the template dynamic so that each developer can customize it only for their needs I think @sunli829 is so busy lately, it would be nice if he assigned a moderator to help him. |
Hello,
Poem #[aoi] , must allow you to choose the strategy for generating generic structure names,
Response<T> for example, should have the symbol name Reponse_T or ResponseForT or ResponseOfT
and Response<[T]> => ResponseOfListT for example.
when I want to generate code with the swagger spec using openapi generator, I get this error because the generic names contain special characters :
Response and Response<[City]> will generate the same structure : ResponseCity , ResponseCity, the generated code has no way of differentiating between them.
but if we rename the [City] to ListCity, for example, the result will be : ResponseCity and ResponseListCity
to simplify, here is the part concerned :
transform [T] into ListOfT , because [ and ] characters are not allowed
to
Thanks in advance 🥇
The text was updated successfully, but these errors were encountered: