-
Notifications
You must be signed in to change notification settings - Fork 197
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
Add a default impl of ToSchema::name() #1096
Add a default impl of ToSchema::name() #1096
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am Not Sure how the Tests are done in this Library but I think a few Tests to Validate the Output would be a good idea.
Yup that's a valid point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is definitely handy for people manually implementing ToSchema
it would be a good idea to write couple of tests to validate the output.
This naive implementation is enough since the name is by default for a type calculated only from the name without generics. Generic args in the name will come from the inner generic types respectively upon schema creation. When users want more advanced name, they can easily override the default functionality and provide their own solution IMO. |
6317aa1
to
b269bad
Compare
Absolutely right for unit test! I've added some documentation too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 super
One thing though, could you add a line (title o the PR) to CHANGELOG.md of in |
b269bad
to
b82f050
Compare
Great, thansk 🙂 |
I suggest adding a default implementation of the ToSchema trait.
This is a naive implementation that takes the type name and removes the module path and generic elements.