Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin/openapi-client-generator
vendor
24 changes: 24 additions & 0 deletions bin/openapi-client-generator.source
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/php
<?php declare(strict_types=1);

use ApiClients\Tools\OpenApiClientGenerator\Generator;
use Symfony\Component\Yaml\Yaml;

(function(): void {
/**
* Require Composer's autoloader
*/
require_once '%s';
})();

(function(string $configuration): void {
/**
* Create and boot up the application
*/
exit((function (string $configuration): int {
$yaml = Yaml::parseFile($configuration);
(new Generator($yaml['spec']))->generate($yaml['namespace'] . '\\', $yaml['destination']);

return 0;
})($configuration));
})($argv[1]);
14 changes: 13 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@
"email": "ceesjank@gmail.com"
}
],
"bin": [
"bin/openapi-client-generator"
],
"extra": {
"wyrihaximus": {
"bin-autoload-path-update": [
"bin/openapi-client-generator"
]
}
},
"require": {
"php": "^7.4",
"cebe/php-openapi": "^1.4",
"jawira/case-converter": "^3.4",
"twig/twig": "^3.0",
"nikic/php-parser": "^4.8",
"psr/http-message": "^1.0",
"ringcentral/psr7": "^1.3"
"ringcentral/psr7": "^1.3",
"symfony/yaml": "^5.2",
"wyrihaximus/composer-update-bin-autoload-path": "^1 || ^1.0.1"
},
"autoload": {
"psr-4": {
Expand Down
52 changes: 51 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions openapi-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spec: https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.yaml
namespace: ApiClients\Client\Github
destination: generated
6 changes: 0 additions & 6 deletions test.php

This file was deleted.