Refactor builds for yaml

This commit is contained in:
David Bomba 2023-02-12 22:14:53 +11:00
parent a295052265
commit 2028027eef
5 changed files with 51 additions and 6 deletions

View File

@ -32,6 +32,11 @@ class OpenApiYaml extends Command
*/ */
protected $description = 'Build OpenApi YAML'; protected $description = 'Build OpenApi YAML';
private array $directories = [
'/components/schemas',
'/paths/'
];
/** /**
* Create a new command instance. * Create a new command instance.
* *
@ -65,11 +70,43 @@ class OpenApiYaml extends Command
Storage::disk('base')->delete('/openapi/api-docs.yaml'); Storage::disk('base')->delete('/openapi/api-docs.yaml');
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/info.yaml')); Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/info.yaml'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/paths/paths.yaml')); Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/paths.yaml'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/paths/clients.yaml'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/components.yaml')); //iterate paths
$directory = new DirectoryIterator($path . '/paths/');
foreach ($directory as $file) {
if ($file->isFile() && ! $file->isDot())
{
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents("{$path}/paths/{$file->getFilename()}"));
}
}
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components.yaml'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/schemas.yaml')); Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/schemas.yaml'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/schemas/account.yaml'));
//iterate schemas
$directory = new DirectoryIterator($path . '/components/schemas/');
foreach ($directory as $file) {
if ($file->isFile() && ! $file->isDot())
{
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents("{$path}/components/schemas/{$file->getFilename()}"));
}
}
// Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/components/schemas/account.yaml'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/misc/misc.yaml')); Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/misc/misc.yaml'));

View File

@ -1,6 +1,6 @@
openapi: 3.0.0 openapi: 3.0.0
info: info:
title: 'Invoice Ninja API Reference - Where self host Invoicing lives.' title: 'Invoice Ninja API Reference - Where self host invoicing lives.'
description: | description: |
--- ---
<br> <br>
@ -15,7 +15,7 @@ info:
license: license:
name: 'Elastic License' name: 'Elastic License'
url: 'https://www.elastic.co/licensing/elastic-license' url: 'https://www.elastic.co/licensing/elastic-license'
version: 1.0.30 version: 5.5.70
servers: servers:
- -
url: 'https://demo.invoiceninja.com' url: 'https://demo.invoiceninja.com'
@ -19355,6 +19355,10 @@ components:
description: 'The account hashed id' description: 'The account hashed id'
type: string type: string
example: AS3df3A example: AS3df3A
account_sms_verified:
description: 'Boolean flag if the account has been verified by sms'
type: string
example: true
type: object type: object
tags: tags:
- -

View File

@ -4,4 +4,8 @@
description: 'The account hashed id' description: 'The account hashed id'
type: string type: string
example: AS3df3A example: AS3df3A
account_sms_verified:
description: 'Boolean flag if the account has been verified by sms'
type: string
example: true
type: object type: object