Open Jakovitz opened 5 years ago
The Swagger output only contains the default input filter from the config, but not the method specific ones. My api in this example is called OrdersApi, and below are excerpts from /apigility/documentation/OrdersApi-v1 that whows the difference:
/apigility/documentation/OrdersApi-v1
{ "name": "OrdersApi", "version": "1", "services": [ { "name": "OrderListener", "route": "/api/order/listener[/:id]", "fields": { "input_filter": { "worker": { "description": "The worker name", "required": true, "type": "", "example": null }, "revision": { "description": "Current revision number", "required": true, "type": "", "example": null } }, "POST": { "worker": { "description": "The worker name", "required": true, "type": "", "example": null } } } } ] }
{ "swagger": "2.0", "info": { "title": "OrdersApi", "version": "1" }, "tags": [ { "name": "OrderListener" } ], "paths": { "/api/order/listener": { "post": { "tags": [ "OrderListener" ], "parameters": [ { "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/OrderListener" } } ] } }, "/api/order/listener/{id}": { "put": { "tags": [ "OrderListener" ], "parameters": [ { "in": "path", "name": "id", "description": "URL parameter id", "type": "string", "required": true, "minimum": 0, "maximum": 1 }, { "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/OrderListener" } } ] } } }, "definitions": { "OrderListener": { "type": "object", "properties": { "worker": { "type": "string", "description": "The worker name" }, "revision": { "type": "string", "description": "Current revision number" } }, "required": [ "worker", "revision" ] } } }
'zf-content-validation' => [ 'OrdersApi\\V1\\Rest\\Order\\Listener\\Controller' => [ 'input_filter' => 'OrdersApi\\V1\\Rest\\Order\\Listener\\Validator', 'POST' => 'OrdersApi\\V1\\Rest\\Order\\Listener\\ValidatorCreate', ], ], 'input_filter_specs' => [ 'OrdersApi\\V1\\Rest\\Order\\Listener\\Validator' => [ [ 'required' => true, 'validators' => [ [ 'name' => \Zend\Validator\NotEmpty::class, 'options' => [], ], [ 'name' => \Zend\Validator\StringLength::class, 'options' => [], ], ], 'filters' => [], 'name' => 'worker', 'description' => 'The worker name', ], [ 'required' => true, 'validators' => [ [ 'name' => \Zend\Validator\NotEmpty::class, 'options' => [], ], [ 'name' => \Zend\Validator\Digits::class, 'options' => [], ], ], 'filters' => [], 'name' => 'revision', 'description' => 'Current revision number', ], ], 'OrdersApi\\V1\\Rest\\Order\\Listener\\ValidatorCreate' => [ [ 'required' => true, 'validators' => [ [ 'name' => \Zend\Validator\NotEmpty::class, 'options' => [], ], [ 'name' => \Zend\Validator\StringLength::class, 'options' => [], ], ], 'filters' => [], 'name' => 'worker', 'description' => 'The worker name', ], ], ],
This repository has been closed and moved to laminas-api-tools/api-tools-documentation-swagger; a new issue has been opened at https://github.com/laminas-api-tools/api-tools-documentation-swagger/issues/2.
The Swagger output only contains the default input filter from the config, but not the method specific ones. My api in this example is called OrdersApi, and below are excerpts from
/apigility/documentation/OrdersApi-v1
that whows the difference:Accept: application/json
Accept: application/vnd.swagger+json
Config