Short description and motivation.
How to use my plugin.
Add this line to your application's Gemfile:
gem 'openstax_swagger'And then execute:
$ bundleOr install it yourself as:
$ gem install openstax_swaggerOpenStax::Swagger.configure do |config|
config.client_language_configs = {
ruby: lambda do |version|
{
gemName: 'my_gem_name',
gemHomepage: 'https://github.com/my_org/my_repo/clients/ruby',
gemRequiredRubyVersion: '>= 2.4',
moduleName: "MyModuleName",
gemVersion: version,
}
end,
javascript: lambda do |version|
{
moduleName: "MyModuleName",
modelPackage: "MyPackage",
projectName: "MyProject",
projectVersion: version,
usePromises: true,
}
end
}
config.client_language_post_processing = {
javascript: -> (options) { OpenStax::Swagger::BundleJsClient.bundle(options) }
}
end...
swagger_path_and_parameters_schema has the same arguments as the native swagger_path method but in addition to generating a swagger path definition, it will also call swagger_schema on the query parameters to let developers generate a binding from this schema to bind to parameters in a controller call (i.e. they can let swagger-codegen generate code that will validate the incoming parameters instead of replicating validity checks in the schema and in the controller). Probably only works for simple parameters, not parameters with nested schemas.
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.