Skip to content

Commit 5156a73

Browse files
committed
Add failing test
1 parent 50e28c0 commit 5156a73

File tree

5 files changed

+63
-3
lines changed

5 files changed

+63
-3
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,4 +568,3 @@ Professional support, consulting as well as software development services are av
568568
https://www.cebe.cc/en/contact
569569

570570
Development of this library is sponsored by [cebe.:cloud: "Your Professional Deployment Platform"](https://cebe.cloud).
571-

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"require": {
2121
"php": "^7.4 || ^8.0",
22-
"cebe/php-openapi": "^1.5.0",
22+
"cebe/php-openapi": "dev-165-better-way-to-resolve-allof",
2323
"yiisoft/yii2": "~2.0.48",
2424
"yiisoft/yii2-gii": "~2.0.0 | ~2.1.0 | ~2.2.0| ~2.3.0",
2525
"laminas/laminas-code": ">=3.4 <=4.13",
@@ -58,6 +58,10 @@
5858
{
5959
"type": "composer",
6060
"url": "https://asset-packagist.org"
61-
}
61+
},
62+
{
63+
"type": "vcs",
64+
"url": "http://github.com/SOHELAHMED7/php-openapi"
65+
}
6266
]
6367
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
return [
4+
'openApiPath' => '@specs/issue_fix/51_bug_allof_with_description/index.yml',
5+
'generateUrls' => true,
6+
'generateModels' => true,
7+
'excludeModels' => [
8+
'Error',
9+
],
10+
'generateControllers' => true,
11+
'generateMigrations' => true,
12+
'generateModelFaker' => true, // `generateModels` must be `true` in order to use `generateModelFaker` as `true`
13+
];
14+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openapi: 3.0.3
2+
3+
info:
4+
title: 'Bug: allOf with description #51'
5+
version: 1.0.0
6+
7+
components:
8+
schemas:
9+
Invoice:
10+
title: Invoice
11+
x-table: invoices
12+
type: object
13+
properties:
14+
id:
15+
type: integer
16+
description: The PK
17+
reference_invoice:
18+
allOf:
19+
- $ref: '#/components/schemas/Invoice'
20+
- x-faker: false
21+
- description: This field is only set on invoices of type "cancellation_invoice"
22+
23+
24+
paths:
25+
'/':
26+
get:
27+
responses:
28+
'200':
29+
description: OK

tests/unit/IssueFixTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,18 @@ public function test158BugGiiapiGeneratedRulesEnumWithTrim()
360360
]);
361361
$this->checkFiles($actualFiles, $expectedFiles);
362362
}
363+
364+
// https://github.com/php-openapi/yii2-openapi/issues/51
365+
public function test51BugAllofWithDescription()
366+
{
367+
$testFile = Yii::getAlias("@specs/issue_fix/51_bug_allof_with_description/index.php");
368+
$this->runGenerator($testFile);
369+
// $actualFiles = FileHelper::findFiles(Yii::getAlias('@app'), [
370+
// 'recursive' => true,
371+
// ]);
372+
// $expectedFiles = FileHelper::findFiles(Yii::getAlias("@specs/issue_fix/51_bug_allof_with_description/mysql"), [
373+
// 'recursive' => true,
374+
// ]);
375+
// $this->checkFiles($actualFiles, $expectedFiles);
376+
}
363377
}

0 commit comments

Comments
 (0)