1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

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';
private array $directories = [
'/components/schemas',
'/paths/'
];
/**
* Create a new command instance.
*
@ -65,11 +70,43 @@ class OpenApiYaml extends Command
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.'/paths/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'));
Storage::disk('base')->append('/openapi/api-docs.yaml', file_get_contents($path.'/paths.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/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'));

View File

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

View File

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