@@ -21,12 +21,13 @@ public static function gather(
21
21
): \ApiClients \Tools \OpenApiClientGenerator \Representation \Schema {
22
22
$ className = Utils::fixKeyword ($ className );
23
23
$ isArray = $ schema ->type === 'array ' ;
24
+ $ properties = [];
25
+ $ example = [];
26
+
24
27
if ($ isArray ) {
25
28
$ schema = $ schema ->items ;
26
29
}
27
30
28
- $ properties = [];
29
- $ example = $ schema ->example ?? [];
30
31
foreach ($ schema ->properties as $ propertyName => $ property ) {
31
32
$ gatheredProperty = Property::gather (
32
33
$ className ,
@@ -37,24 +38,19 @@ public static function gather(
37
38
);
38
39
$ properties [] = $ gatheredProperty ;
39
40
40
- if (array_key_exists ($ gatheredProperty ->sourceName , $ example )) {
41
- continue ;
41
+ foreach (['examples ' , 'example ' ] as $ examplePropertyName ) {
42
+ if (array_key_exists ($ gatheredProperty ->sourceName , $ example )) {
43
+ break ;
44
+ }
45
+
46
+ if (property_exists ($ schema , $ examplePropertyName ) && is_array ($ schema ->$ examplePropertyName ) && array_key_exists ($ gatheredProperty ->sourceName , $ schema ->$ examplePropertyName )) {
47
+ $ example [$ gatheredProperty ->sourceName ] = $ schema ->$ examplePropertyName [$ gatheredProperty ->sourceName ];
48
+ }
42
49
}
43
50
44
51
$ example [$ gatheredProperty ->sourceName ] = $ gatheredProperty ->exampleData ;
45
52
}
46
53
47
- // if ($className === 'WebhookWorkflowRunCompleted\WorkflowRun') {
48
- // var_export([
49
- // $className,
50
- // $schema->title ?? '',
51
- // $schema->description ?? '',
52
- // $example,
53
- //// $properties,
54
- // $isArray,
55
- // ]);
56
- // }
57
-
58
54
return new \ApiClients \Tools \OpenApiClientGenerator \Representation \Schema (
59
55
$ className ,
60
56
$ schema ->title ?? '' ,
0 commit comments