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.
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/spikard/config.rb', line 316 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.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def contact @contact end |
#description ⇒ Object
Returns the value of attribute description.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def description @description end |
#enabled ⇒ Object
Returns the value of attribute enabled.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def enabled @enabled end |
#license ⇒ Object
Returns the value of attribute license.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def license @license end |
#openapi_json_path ⇒ Object
Returns the value of attribute openapi_json_path.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def openapi_json_path @openapi_json_path end |
#redoc_path ⇒ Object
Returns the value of attribute redoc_path.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def redoc_path @redoc_path end |
#security_schemes ⇒ Object
Returns the value of attribute security_schemes.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def security_schemes @security_schemes end |
#servers ⇒ Object
Returns the value of attribute servers.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def servers @servers end |
#swagger_ui_path ⇒ Object
Returns the value of attribute swagger_ui_path.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def swagger_ui_path @swagger_ui_path end |
#title ⇒ Object
Returns the value of attribute title.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
301 302 303 |
# File 'lib/spikard/config.rb', line 301 def version @version end |