37 lines
		
	
	
		
			719 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			719 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| module SwaggerResponseHelper
 | |
|   def response_422
 | |
|     response(422, 'Validation errors in input parameters') do
 | |
|       produces 'application/json'
 | |
|       error_schema
 | |
|       xit
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   def response_empty_200
 | |
|     response(200, 'Success') do
 | |
|       produces 'application/json'
 | |
|       schema type: :object
 | |
|       xit
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   def response_404
 | |
|     response(404, 'Record not found') do
 | |
|       produces 'application/json'
 | |
|       error_schema
 | |
|       xit
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   private
 | |
| 
 | |
|   def error_schema
 | |
|     schema type: :object,
 | |
|            required: %i[message errors],
 | |
|            properties: {
 | |
|              message: { type: :string },
 | |
|              errors: { type: :array, items: { type: :string } }
 | |
|            }
 | |
|   end
 | |
| end
 |