10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/docit/schema_generator.rb', line 10
def generate
config = Docit.configuration
spec = {
openapi: "3.0.3",
info: {
title: config.title,
version: config.version,
description: config.description
},
paths: build_paths,
components: {
securitySchemes: config.security_schemes
}
}
tag_defs = config.tags
spec[:tags] = tag_defs if tag_defs.any?
server_defs = config.servers
spec[:servers] = server_defs if server_defs.any?
schemas = build_component_schemas
spec[:components][:schemas] = schemas if schemas.any?
spec
end
|