We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hey,
I currently came across an issue where we annotate the code with uppercase "Integer", but Swagger only supports lowercase integer. https://swagger.io/docs/specification/data-models/data-types/
integer
Is there a way to force it to be lowercase or have a way to convert types to a different name?
It could be nice to have a hash where you can map to custom types.
Something like this maybe
{ "Integer" => "integer" }
The text was updated successfully, but these errors were encountered:
This block of code is where identifiers are handled by the parser.
https://github.com/livingsocial/swagger_yard/blob/master/lib/swagger_yard/type_parser.rb#L70-L75
Looks like you could monkeypatch the SwaggerYard::Model.mangle method and add your custom behaviors:
SwaggerYard::Model.mangle
class SwaggerYard::Model def self.mangle(name) case name when /Integer/ name.downcase else name.gsub(/[^[:alnum:]_]+/, '_') end end end
If you want to submit a patch to add some more formalized custom type mapping, feel free to submit a PR.
Sorry, something went wrong.
Thanks for the quick reply.
I would love to do a PR, just I don't have the time for it 😞
I ended up adding this monkeypatch, maybe I will add more types later. I only found an issue with String and Integer types now.
String and Integer
module SwaggerYard class Model def self.mangle(name) case name when /string/i then name.downcase when /integer/i then name.downcase else name.gsub(/[^[:alnum:]_]+/, '_') end end end end
No branches or pull requests
Hey,
I currently came across an issue where we annotate the code with uppercase "Integer", but Swagger only supports lowercase
integer
.https://swagger.io/docs/specification/data-models/data-types/
Is there a way to force it to be lowercase or have a way to convert types to a different name?
It could be nice to have a hash where you can map to custom types.
Something like this maybe
The text was updated successfully, but these errors were encountered: