-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoooas.php
37 lines (34 loc) · 1.2 KB
/
oooas.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
use AdrienBrault\Instructrice\Instructrice;
use AdrienBrault\Instructrice\InstructriceFactory;
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
$demo = require __DIR__ . '/bootstrap.php';
$demo(function (Instructrice $instructrice, ?string $context, ConsoleOutputInterface $output) {
$instructrice->get(
Schema::object()
->properties(
Schema::string('name'),
Schema::string('dateOfBirth')->format(Schema::FORMAT_DATE_TIME),
Schema::boolean('isAlive'),
Schema::array('significantContributions')
->items(Schema::string()),
)
->toArray(),
'Most impact scientists in history.',
onChunk: InstructriceFactory::createOnChunkDump($output->section()),
);
});
/*
array:4 [
"name" => "Marie Curie"
"dateOfBirth" => "1867-11-07"
"isAlive" => false
"significantContributions" => array:3 [
0 => "Pioneered radioactivity research"
1 => "First woman to win a Nobel Prize"
2 => "First person to win two Nobel Prizes in different fields (Physics and Chemistry)"
]
]
*/