Skip to content

slate-studio/mongoid-openapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mongoid OpenAPI

Rails concern to implement CRUD API controllers for Mongoid models using Open API (Swagger) specification.

Swagger generator

Automatic generate powerful representation of your RESTful API.

Setup:

  • Add to you Controller include SwaggerGenerator
  • Add to the end of controller: generate_swagger to generate swagger description of current controller's actions
  • To integrate these description with Swagger UI - Add routes and create Swagger Controller
  • Check Swagger UI at localhost:3000/docs/api/swaggers

Swagger generator has several configurations/options

swagger_options:

  • json_requests: true - make all call in json format
  • scopes: [ { name: :selects, type: :boolean } ] - add sope to swagger
  • resource_class_name: 'UserProfessional' - customize resource/model name. For case, when you have ProfileController, but working/using UserProfessional model here
  • ignore_custom_actions: true - don't generate custom/not CRUD actions
  • collection_name: 'Bootstrap' - For Customize tags and OperationId postfix
  • base_path: '/api/admin' - if you using key :basePath in Swagger Controller write it here
  • relative_path: 'professional/projects' (Will be depricated and using only base_path) - use relative path without basePath for actions.Might be helpfull when key :basePath, '/api' present in Swagger Controller, to prevent generating paths: 'api/api/professional/projects'

About

Generate and customize Open API interface for Mongoid models.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages