-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Salvo does not take into account the schema name for generics #754
Comments
Hi, I don't really see this as an issue. Could you point out which framework allows you to handle the names of generic types as you wish? I also added a test case using your code as an example(#755 ), so that we can be notified in case the names of generic types need to be beautified in the future. |
Hello, (thank you for your reply) and display the main purpose of swagger is automatic code generation, and swagger UI must display a human friendly representation. |
It makes sense.
However, in the OpenAPI documentation, it is explicitly stated that the value of the ref property should be a URI, which identifies the location of the value being referenced. So let's just keep it that way. |
Why not add a “short_uri=true” option, for example, to allow the $ref to be renamed with :
in this case it will be XXXXXX |
Naming conflicts are likely to occur if If we have to do this, my suggestion is to add another field to record the shorter name (Which is not within the OpenAPI specification). @chrislearn Please take a look. |
#619 Could be related. |
@zhangkai803 I understand your point of view, and you're absolutely right, it's the safest way to go. But, we generally use a short name to avoid problems with code generators (https://openapi-generator.tech/), and also to make the documentation readable. even the official Swagger example doesn't use long paths : and the most widely used library in the Java/Spring universe (same thing it uses a name for the $ref) : Thanks for your interest in my request. |
for example, add a mapping like this :
already ' :: ' is not standard in code generation, and for a hacker, it gives a lot of information about the technology used in the backend. (In this case, we can easily deduce that the backend is made in Rust and uses Salvo as a server.) although I think the ideal would be : title = SYMBOL_1 with |
@zhangkai803 Thank you for taking the time to work on this subject. 👍 |
Hello,
I've noticed that when using generics, salvo doesn't take the schema name into account but gives the full path name of the struct.
let's take the example of these two structures :
and this is the simplified Rest controller :
here's the result swagger :
generic names are no good :
normally it would be :
thanks in advance
The text was updated successfully, but these errors were encountered: