myMVC_module_OpenApi
1.1.0
pdo extensiongit clone --branch 3.x https://github.com/gueff/myMVC.git myMVC_3.xgit clone
cd /modules/;
git clone --branch 1.x
https://github.com/gueff/myMVC_module_OpenApi.git
OpenApi;validate against openapi file
use OpenApiModelValidate;
$oDTValidateRequestResponse = Validate::request(
$oDTRequestCurrent,
Config::get_MVC_PUBLIC_PATH() . '/openapi/api.yaml'
);
header('Content-Type: application/json');
echo json_encode(Convert::objectToArray($oDTValidateRequestResponse));validate against openapi URL
use OpenApiModelValidate;
// validate against openapi URL
$oDTValidateRequestResponse = Validate::request(
$oDTRequestCurrent,
'https://example.com/api/openapi.yaml'
);
header('Content-Type: application/json');
echo json_encode(Convert::objectToArray($oDTValidateRequestResponse));auto-creating myMVC Routes from openapi file
All Routes lead to their given operationId, set in openapi
OpenApiModelRoute::autoCreateFromOpenApiFile(
Config::get_MVC_PUBLIC_PATH() . '/openapi/api.yaml',
'FooControllerApi'
);All Routes lead explicitely to Api::delegate()
OpenApiModelRoute::autoCreateFromOpenApiFile(
Config::get_MVC_PUBLIC_PATH() . '/openapi/api.yaml',
'FooControllerApi',
'delegate'
);Logs are fired to Events.
Available events are:
myMVC_module_OpenApi::sYamlSourcelisten to event and write its content to a logfile
MVCEvent::bind('myMVC_module_OpenApi::sYamlSource', function($sContent){
MVCLog::write($sContent, 'openapi.log');
});