262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
# File 'lib/betterdocs/generator/swagger.rb', line 262
def add_links_definition(definitions, cls, value)
definition = initialise_definition(definitions, cls)
definition[:properties][:links] ||= {
type: 'array',
nullable: false,
items: {
type: 'object',
properties: {
rel: { type: 'string', enum: [] },
href: { type: 'string' },
templated: { type: 'boolean' }
},
required: %w[rel href]
}
}
enum = definition[:properties][:links][:items][:properties][:rel][:enum]
enum.push(value) unless enum.include?(value)
end
|