'PATCH', 'basePathWithoutHost' => '/v2', 'path' => '/another-fake/dummy', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractAnotherFakeApi', 'userClassname' => 'AnotherFakeApi', 'operationId' => 'call123TestSpecialTags', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Client" } } } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/fake/create_xml_item', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'createXmlItem', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/fake/outer/boolean', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'fakeOuterBooleanSerialize', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'Output boolean', 'jsonSchema' => '{ "description" : "Output boolean", "content" : { "*/*" : { "schema" : { "$ref" : "#/components/schemas/OuterBoolean" } } } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/fake/outer/composite', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'fakeOuterCompositeSerialize', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'Output composite', 'jsonSchema' => '{ "description" : "Output composite", "content" : { "*/*" : { "schema" : { "$ref" : "#/components/schemas/OuterComposite" } } } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/fake/outer/number', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'fakeOuterNumberSerialize', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'Output number', 'jsonSchema' => '{ "description" : "Output number", "content" : { "*/*" : { "schema" : { "$ref" : "#/components/schemas/OuterNumber" } } } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/fake/outer/string', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'fakeOuterStringSerialize', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'Output string', 'jsonSchema' => '{ "description" : "Output string", "content" : { "*/*" : { "schema" : { "$ref" : "#/components/schemas/OuterString" } } } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'PUT', 'basePathWithoutHost' => '/v2', 'path' => '/fake/body-with-file-schema', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testBodyWithFileSchema', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'Success', 'jsonSchema' => '{ "description" : "Success", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'PUT', 'basePathWithoutHost' => '/v2', 'path' => '/fake/body-with-query-params', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testBodyWithQueryParams', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'Success', 'jsonSchema' => '{ "description" : "Success", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'PATCH', 'basePathWithoutHost' => '/v2', 'path' => '/fake', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testClientModel', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Client" } } } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/fake', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testEndpointParameters', 'responses' => [ '400' => [ 'code' => 400, 'message' => 'Invalid username supplied', 'jsonSchema' => '{ "description" : "Invalid username supplied", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'User not found', 'jsonSchema' => '{ "description" : "User not found", "content" : { } }', ], ], 'authMethods' => [ // http security schema named 'http_basic_test' [ 'type' => 'http', 'isBasic' => true, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => false, ], ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/fake', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testEnumParameters', 'responses' => [ '400' => [ 'code' => 400, 'message' => 'Invalid request', 'jsonSchema' => '{ "description" : "Invalid request", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'Not found', 'jsonSchema' => '{ "description" : "Not found", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'DELETE', 'basePathWithoutHost' => '/v2', 'path' => '/fake', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testGroupParameters', 'responses' => [ '400' => [ 'code' => 400, 'message' => 'Someting wrong', 'jsonSchema' => '{ "description" : "Someting wrong", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/fake/inline-additionalProperties', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testInlineAdditionalProperties', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/fake/jsonFormData', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testJsonFormData', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'PUT', 'basePathWithoutHost' => '/v2', 'path' => '/fake/test-query-paramters', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeApi', 'userClassname' => 'FakeApi', 'operationId' => 'testQueryParameterCollectionFormat', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'Success', 'jsonSchema' => '{ "description" : "Success", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'PATCH', 'basePathWithoutHost' => '/v2', 'path' => '/fake_classname_test', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractFakeClassnameTags123Api', 'userClassname' => 'FakeClassnameTags123Api', 'operationId' => 'testClassname', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/Client" } } } }', ], ], 'authMethods' => [ // apiKey security schema named 'api_key_query' [ 'type' => 'apiKey', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => true, 'isOAuth' => false, 'keyParamName' => 'api_key_query', 'isKeyInHeader' => false, 'isKeyInQuery' => true, 'isKeyInCookie' => false, ], ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/pet', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'addPet', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], '405' => [ 'code' => 405, 'message' => 'Invalid input', 'jsonSchema' => '{ "description" : "Invalid input", "content" : { } }', ], ], 'authMethods' => [ // oauth2 security schema named 'petstore_auth' [ 'type' => 'oauth2', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => true, 'scopes' => [ 'write:pets', // modify pets in your account 'read:pets', // read your pets ], ], ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/pet/findByStatus', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'findPetsByStatus', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/xml" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/Pet" } } }, "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/Pet" } } } } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid status value', 'jsonSchema' => '{ "description" : "Invalid status value", "content" : { } }', ], ], 'authMethods' => [ // oauth2 security schema named 'petstore_auth' [ 'type' => 'oauth2', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => true, 'scopes' => [ 'write:pets', // modify pets in your account 'read:pets', // read your pets ], ], ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/pet/findByTags', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'findPetsByTags', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/xml" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/Pet" } } }, "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/Pet" } } } } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid tag value', 'jsonSchema' => '{ "description" : "Invalid tag value", "content" : { } }', ], ], 'authMethods' => [ // oauth2 security schema named 'petstore_auth' [ 'type' => 'oauth2', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => true, 'scopes' => [ 'write:pets', // modify pets in your account 'read:pets', // read your pets ], ], ], ], [ 'httpMethod' => 'PUT', 'basePathWithoutHost' => '/v2', 'path' => '/pet', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'updatePet', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid ID supplied', 'jsonSchema' => '{ "description" : "Invalid ID supplied", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'Pet not found', 'jsonSchema' => '{ "description" : "Pet not found", "content" : { } }', ], '405' => [ 'code' => 405, 'message' => 'Validation exception', 'jsonSchema' => '{ "description" : "Validation exception", "content" : { } }', ], ], 'authMethods' => [ // oauth2 security schema named 'petstore_auth' [ 'type' => 'oauth2', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => true, 'scopes' => [ 'write:pets', // modify pets in your account 'read:pets', // read your pets ], ], ], ], [ 'httpMethod' => 'DELETE', 'basePathWithoutHost' => '/v2', 'path' => '/pet/{petId}', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'deletePet', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid pet value', 'jsonSchema' => '{ "description" : "Invalid pet value", "content" : { } }', ], ], 'authMethods' => [ // oauth2 security schema named 'petstore_auth' [ 'type' => 'oauth2', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => true, 'scopes' => [ 'write:pets', // modify pets in your account 'read:pets', // read your pets ], ], ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/pet/{petId}', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'getPetById', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/xml" : { "schema" : { "$ref" : "#/components/schemas/Pet" } }, "application/json" : { "schema" : { "$ref" : "#/components/schemas/Pet" } } } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid ID supplied', 'jsonSchema' => '{ "description" : "Invalid ID supplied", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'Pet not found', 'jsonSchema' => '{ "description" : "Pet not found", "content" : { } }', ], ], 'authMethods' => [ // apiKey security schema named 'api_key' [ 'type' => 'apiKey', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => true, 'isOAuth' => false, 'keyParamName' => 'api_key', 'isKeyInHeader' => true, 'isKeyInQuery' => false, 'isKeyInCookie' => false, ], ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/pet/{petId}', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'updatePetWithForm', 'responses' => [ '405' => [ 'code' => 405, 'message' => 'Invalid input', 'jsonSchema' => '{ "description" : "Invalid input", "content" : { } }', ], ], 'authMethods' => [ // oauth2 security schema named 'petstore_auth' [ 'type' => 'oauth2', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => true, 'scopes' => [ 'write:pets', // modify pets in your account 'read:pets', // read your pets ], ], ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/pet/{petId}/uploadImage', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'uploadFile', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ApiResponse" } } } }', ], ], 'authMethods' => [ // oauth2 security schema named 'petstore_auth' [ 'type' => 'oauth2', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => true, 'scopes' => [ 'write:pets', // modify pets in your account 'read:pets', // read your pets ], ], ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/fake/{petId}/uploadImageWithRequiredFile', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractPetApi', 'userClassname' => 'PetApi', 'operationId' => 'uploadFileWithRequiredFile', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/ApiResponse" } } } }', ], ], 'authMethods' => [ // oauth2 security schema named 'petstore_auth' [ 'type' => 'oauth2', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => false, 'isOAuth' => true, 'scopes' => [ 'write:pets', // modify pets in your account 'read:pets', // read your pets ], ], ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/store/inventory', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractStoreApi', 'userClassname' => 'StoreApi', 'operationId' => 'getInventory', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/json" : { "schema" : { "type" : "object", "additionalProperties" : { "type" : "integer", "format" : "int32" } } } } }', ], ], 'authMethods' => [ // apiKey security schema named 'api_key' [ 'type' => 'apiKey', 'isBasic' => false, 'isBearer' => false, 'isApiKey' => true, 'isOAuth' => false, 'keyParamName' => 'api_key', 'isKeyInHeader' => true, 'isKeyInQuery' => false, 'isKeyInCookie' => false, ], ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/store/order', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractStoreApi', 'userClassname' => 'StoreApi', 'operationId' => 'placeOrder', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/xml" : { "schema" : { "$ref" : "#/components/schemas/Order" } }, "application/json" : { "schema" : { "$ref" : "#/components/schemas/Order" } } } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid Order', 'jsonSchema' => '{ "description" : "Invalid Order", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'DELETE', 'basePathWithoutHost' => '/v2', 'path' => '/store/order/{order_id}', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractStoreApi', 'userClassname' => 'StoreApi', 'operationId' => 'deleteOrder', 'responses' => [ '400' => [ 'code' => 400, 'message' => 'Invalid ID supplied', 'jsonSchema' => '{ "description" : "Invalid ID supplied", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'Order not found', 'jsonSchema' => '{ "description" : "Order not found", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/store/order/{order_id}', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractStoreApi', 'userClassname' => 'StoreApi', 'operationId' => 'getOrderById', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/xml" : { "schema" : { "$ref" : "#/components/schemas/Order" } }, "application/json" : { "schema" : { "$ref" : "#/components/schemas/Order" } } } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid ID supplied', 'jsonSchema' => '{ "description" : "Invalid ID supplied", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'Order not found', 'jsonSchema' => '{ "description" : "Order not found", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/user', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractUserApi', 'userClassname' => 'UserApi', 'operationId' => 'createUser', 'responses' => [ 'default' => [ 'code' => 0, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/user/createWithArray', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractUserApi', 'userClassname' => 'UserApi', 'operationId' => 'createUsersWithArrayInput', 'responses' => [ 'default' => [ 'code' => 0, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'POST', 'basePathWithoutHost' => '/v2', 'path' => '/user/createWithList', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractUserApi', 'userClassname' => 'UserApi', 'operationId' => 'createUsersWithListInput', 'responses' => [ 'default' => [ 'code' => 0, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/user/login', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractUserApi', 'userClassname' => 'UserApi', 'operationId' => 'loginUser', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "headers" : { "X-Rate-Limit" : { "description" : "calls per hour allowed by the user", "schema" : { "type" : "integer", "format" : "int32" } }, "X-Expires-After" : { "description" : "date in UTC when token expires", "schema" : { "type" : "string", "format" : "date-time" } } }, "content" : { "application/xml" : { "schema" : { "type" : "string" } }, "application/json" : { "schema" : { "type" : "string" } } } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid username/password supplied', 'jsonSchema' => '{ "description" : "Invalid username/password supplied", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/user/logout', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractUserApi', 'userClassname' => 'UserApi', 'operationId' => 'logoutUser', 'responses' => [ 'default' => [ 'code' => 0, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'DELETE', 'basePathWithoutHost' => '/v2', 'path' => '/user/{username}', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractUserApi', 'userClassname' => 'UserApi', 'operationId' => 'deleteUser', 'responses' => [ '400' => [ 'code' => 400, 'message' => 'Invalid username supplied', 'jsonSchema' => '{ "description" : "Invalid username supplied", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'User not found', 'jsonSchema' => '{ "description" : "User not found", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'GET', 'basePathWithoutHost' => '/v2', 'path' => '/user/{username}', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractUserApi', 'userClassname' => 'UserApi', 'operationId' => 'getUserByName', 'responses' => [ 'default' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ "description" : "successful operation", "content" : { "application/xml" : { "schema" : { "$ref" : "#/components/schemas/User" } }, "application/json" : { "schema" : { "$ref" : "#/components/schemas/User" } } } }', ], '400' => [ 'code' => 400, 'message' => 'Invalid username supplied', 'jsonSchema' => '{ "description" : "Invalid username supplied", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'User not found', 'jsonSchema' => '{ "description" : "User not found", "content" : { } }', ], ], 'authMethods' => [ ], ], [ 'httpMethod' => 'PUT', 'basePathWithoutHost' => '/v2', 'path' => '/user/{username}', 'apiPackage' => 'OpenAPIServer\Api', 'classname' => 'AbstractUserApi', 'userClassname' => 'UserApi', 'operationId' => 'updateUser', 'responses' => [ '400' => [ 'code' => 400, 'message' => 'Invalid user supplied', 'jsonSchema' => '{ "description" : "Invalid user supplied", "content" : { } }', ], '404' => [ 'code' => 404, 'message' => 'User not found', 'jsonSchema' => '{ "description" : "User not found", "content" : { } }', ], ], 'authMethods' => [ ], ], ]; /** * Class constructor * * @param ContainerInterface|array $settings Either a ContainerInterface or an associative array of app settings * * @throws Exception When implementation class doesn't exists */ public function __construct($settings = []) { if ($settings instanceof ContainerInterface) { // Set container to create App with on AppFactory AppFactory::setContainer($settings); } $this->slimApp = AppFactory::create(); // middlewares requires Psr\Container\ContainerInterface $container = $this->slimApp->getContainer(); $authPackage = 'OpenAPIServer\Auth'; $basicAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) { $message = "How about extending AbstractAuthenticator class by {$authPackage}\BasicAuthenticator?"; throw new Exception($message); }; $apiKeyAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) { $message = "How about extending AbstractAuthenticator class by {$authPackage}\ApiKeyAuthenticator?"; throw new Exception($message); }; $oAuthAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) { $message = "How about extending AbstractAuthenticator class by {$authPackage}\OAuthAuthenticator?"; throw new Exception($message); }; $userOptions = $this->getSetting($settings, 'tokenAuthenticationOptions', null); // mocker options $mockerOptions = $this->getSetting($settings, 'mockerOptions', null); $dataMocker = $mockerOptions['dataMocker'] ?? new OpenApiDataMocker(); $getMockResponseCallback = $mockerOptions['getMockResponseCallback'] ?? null; $mockAfterCallback = $mockerOptions['afterCallback'] ?? null; foreach ($this->operations as $operation) { $callback = function ($request, $response, $arguments) use ($operation) { $message = "How about extending {$operation['classname']} by {$operation['apiPackage']}\\{$operation['userClassname']} class implementing {$operation['operationId']} as a {$operation['httpMethod']} method?"; throw new Exception($message); $response->getBody()->write($message); return $response->withStatus(501); }; $middlewares = [new JsonBodyParserMiddleware()]; if (class_exists("\\{$operation['apiPackage']}\\{$operation['userClassname']}")) { $callback = "\\{$operation['apiPackage']}\\{$operation['userClassname']}:{$operation['operationId']}"; } foreach ($operation['authMethods'] as $authMethod) { switch ($authMethod['type']) { case 'http': $authenticatorClassname = "\\{$authPackage}\\BasicAuthenticator"; if (class_exists($authenticatorClassname)) { $basicAuthenticator = new $authenticatorClassname($container); } $middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([ 'authenticator' => $basicAuthenticator, 'regex' => $authMethod['isBearer'] ? '/Bearer\s+(.*)$/i' : '/Basic\s+(.*)$/i', 'header' => 'Authorization', 'parameter' => null, 'cookie' => null, 'argument' => null, ], $userOptions)); break; case 'apiKey': $authenticatorClassname = "\\{$authPackage}\\ApiKeyAuthenticator"; if (class_exists($authenticatorClassname)) { $apiKeyAuthenticator = new $authenticatorClassname($container); } $middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([ 'authenticator' => $apiKeyAuthenticator, 'regex' => '/^(.*)$/i', 'header' => $authMethod['isKeyInHeader'] ? $authMethod['keyParamName'] : null, 'parameter' => $authMethod['isKeyInQuery'] ? $authMethod['keyParamName'] : null, 'cookie' => $authMethod['isKeyInCookie'] ? $authMethod['keyParamName'] : null, 'argument' => null, ], $userOptions)); break; case 'oauth2': $authenticatorClassname = "\\{$authPackage}\\OAuthAuthenticator"; if (class_exists($authenticatorClassname)) { $oAuthAuthenticator = new $authenticatorClassname($container, $authMethod['scopes']); } $middlewares[] = new TokenAuthentication($this->getTokenAuthenticationOptions([ 'authenticator' => $oAuthAuthenticator, 'regex' => '/Bearer\s+(.*)$/i', 'header' => 'Authorization', 'parameter' => null, 'cookie' => null, 'argument' => null, ], $userOptions)); break; default: throw new Exception('Unknown authorization schema type'); } } if (is_callable($getMockResponseCallback)) { $middlewares[] = new OpenApiDataMockerMiddleware($dataMocker, $operation['responses'], $getMockResponseCallback, $mockAfterCallback); } $this->addRoute( [$operation['httpMethod']], "{$operation['basePathWithoutHost']}{$operation['path']}", $callback, $middlewares )->setName($operation['operationId']); } } /** * Merges user defined options with dynamic params * * @param array $staticOptions Required static options * @param array $userOptions User options * * @return array Merged array */ private function getTokenAuthenticationOptions(array $staticOptions, array $userOptions = null) { if (is_array($userOptions) === false) { return $staticOptions; } return array_merge($userOptions, $staticOptions); } /** * Returns app setting by name. * * @param ContainerInterface|array $settings Either a ContainerInterface or an associative array of app settings * @param string $settingName Setting name * @param mixed $default Default setting value. * * @return mixed */ private function getSetting($settings, $settingName, $default = null) { if ($settings instanceof ContainerInterface && $settings->has($settingName)) { return $settings->get($settingName); } elseif (is_array($settings) && array_key_exists($settingName, $settings)) { return $settings[$settingName]; } return $default; } /** * Add route with multiple methods * * @param string[] $methods Numeric array of HTTP method names * @param string $pattern The route URI pattern * @param callable|string $callable The route callback routine * @param array|null $middlewares List of middlewares * * @return RouteInterface * * @throws InvalidArgumentException If the route pattern isn't a string */ public function addRoute(array $methods, string $pattern, $callable, $middlewares = []) { $route = $this->slimApp->map($methods, $pattern, $callable); foreach ($middlewares as $middleware) { $route->add($middleware); } return $route; } /** * Returns Slim Framework instance * * @return App */ public function getSlimApp() { return $this->slimApp; } }