Class: Spikard::OpenApiConfig
- Inherits:
-
Object
- Object
- Spikard::OpenApiConfig
- Defined in:
- lib/spikard/config.rb
Overview
OpenAPI 3.1.0 documentation configuration.
Spikard can automatically generate OpenAPI documentation from your routes. When enabled, it serves:
-
Swagger UI at /docs (customizable)
-
Redoc at /redoc (customizable)
-
OpenAPI JSON spec at /openapi.json (customizable)
Security schemes are auto-detected from middleware configuration. Schemas are generated from your route type hints and validation.
Instance Attribute Summary collapse
-
#contact ⇒ Object
Returns the value of attribute contact.
-
#description ⇒ Object
Returns the value of attribute description.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#license ⇒ Object
Returns the value of attribute license.
-
#openapi_json_path ⇒ Object
Returns the value of attribute openapi_json_path.
-
#redoc_path ⇒ Object
Returns the value of attribute redoc_path.
-
#security_schemes ⇒ Object
Returns the value of attribute security_schemes.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#swagger_ui_path ⇒ Object
Returns the value of attribute swagger_ui_path.
-
#title ⇒ Object
Returns the value of attribute title.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(enabled: false, title: 'API', version: '1.0.0', description: nil, swagger_ui_path: '/docs', redoc_path: '/redoc', openapi_json_path: '/openapi.json', contact: nil, license: nil, servers: [], security_schemes: {}) ⇒ OpenApiConfig
constructor
A new instance of OpenApiConfig.
Constructor Details
#initialize(enabled: false, title: 'API', version: '1.0.0', description: nil, swagger_ui_path: '/docs', redoc_path: '/redoc', openapi_json_path: '/openapi.json', contact: nil, license: nil, servers: [], security_schemes: {}) ⇒ OpenApiConfig
Returns a new instance of OpenApiConfig.
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/spikard/config.rb', line 292 def initialize( enabled: false, title: 'API', version: '1.0.0', description: nil, swagger_ui_path: '/docs', redoc_path: '/redoc', openapi_json_path: '/openapi.json', contact: nil, license: nil, servers: [], security_schemes: {} ) @enabled = enabled @title = title @version = version @description = description @swagger_ui_path = swagger_ui_path @redoc_path = redoc_path @openapi_json_path = openapi_json_path @contact = contact @license = license @servers = servers @security_schemes = security_schemes end |
Instance Attribute Details
#contact ⇒ Object
Returns the value of attribute contact.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def contact @contact end |
#description ⇒ Object
Returns the value of attribute description.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def description @description end |
#enabled ⇒ Object
Returns the value of attribute enabled.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def enabled @enabled end |
#license ⇒ Object
Returns the value of attribute license.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def license @license end |
#openapi_json_path ⇒ Object
Returns the value of attribute openapi_json_path.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def openapi_json_path @openapi_json_path end |
#redoc_path ⇒ Object
Returns the value of attribute redoc_path.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def redoc_path @redoc_path end |
#security_schemes ⇒ Object
Returns the value of attribute security_schemes.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def security_schemes @security_schemes end |
#servers ⇒ Object
Returns the value of attribute servers.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def servers @servers end |
#swagger_ui_path ⇒ Object
Returns the value of attribute swagger_ui_path.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def swagger_ui_path @swagger_ui_path end |
#title ⇒ Object
Returns the value of attribute title.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
277 278 279 |
# File 'lib/spikard/config.rb', line 277 def version @version end |