Method: Betterdocs::Generator::Swagger#add_error_envelope_schema

Defined in:
lib/betterdocs/generator/swagger.rb

#add_error_envelope_schema(definitions) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/betterdocs/generator/swagger.rb', line 151

def add_error_envelope_schema(definitions)
  definitions['ErrorEnvelope'] = {
    type: 'object',
    properties: {
      name: { type: 'string' },
      status: { type: 'string' },
      status_code: { type: 'integer' },
      reason: { type: 'string' },
      backtrace: { type: 'array', items: { type: 'string' } },
      message: { type: 'string' },
      errors: { type: 'object' },
      links: { type: 'array', items: { type: 'string' } }
    },
    required: %w[name status status_code reason backtrace message links]
  }
end