mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:47:32 -05:00 
			
		
		
		
	Refactor builds for yaml
This commit is contained in:
		
							parent
							
								
									a295052265
								
							
						
					
					
						commit
						2028027eef
					
				@ -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'));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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:
 | 
			
		||||
  -
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user