Module: OpenapiMinitest::DSL
- Defined in:
- lib/openapi_minitest/dsl.rb
Instance Method Summary collapse
-
#document_response(schema: nil, summary: nil, description: nil, tags: [], operation_id: nil, deprecated: false, strict: nil) ⇒ Object
Records the current request/response for OpenAPI documentation.
Instance Method Details
#document_response(schema: nil, summary: nil, description: nil, tags: [], operation_id: nil, deprecated: false, strict: nil) ⇒ Object
Records the current request/response for OpenAPI documentation.
Call this after making a request and asserting the response status. It captures all the details needed for OpenAPI generation.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/openapi_minitest/dsl.rb', line 57 def document_response(schema: nil, summary: nil, description: nil, tags: [], operation_id: nil, deprecated: false, strict: nil) # Validate schema if provided and validation is enabled if schema && OpenapiMinitest.configuration.validate_schema && response.body.present? use_strict = strict.nil? ? OpenapiMinitest.configuration.strict_validation : strict validate_response_schema!(schema, strict: use_strict) end # Record for OpenAPI generation ResultCollector.instance.record( request: request, response: response, schema: normalize_schema(schema), summary: summary || generate_summary, description: description, tags: Array(), operation_id: operation_id, deprecated: deprecated, test_name: name ) end |