PHP code example of on1kel / oas-profile-31

1. Go to this page and download the library: Download on1kel/oas-profile-31 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

on1kel / oas-profile-31 example snippets


use On1kel\OAS\Profile31\Bootstrap\PipelineFactory;
use On1kel\OAS\Contract\Profile\Enum\Strictness;

$pipeline = PipelineFactory::makeDefault();

$report = $pipeline->parseAndValidate(
    __DIR__.'/openapi.yaml',
    Strictness::Strict
);

foreach ($report->all() as $error) {
    echo "{$error->severity->name}: {$error->message}\n";
}
bash
php vendor/bin/oas-validate openapi.yaml
bash
php vendor/bin/oas-validate openapi.yaml --format=json