-
Notifications
You must be signed in to change notification settings - Fork 934
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add .gitattributes and .editorconfig * Add basic fixer to ensure we have a @license docblock * Add missing dev autoload config
- Loading branch information
1 parent
117caa0
commit 46c3e4c
Showing
10 changed files
with
289 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
; top-most EditorConfig file | ||
root = true | ||
|
||
; Unix-style newlines | ||
[*] | ||
charset = utf-8 | ||
end_of_line = LF | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{php,json,yaml}] | ||
indent_style = space | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/.* export-ignore | ||
/tools/ export-ignore | ||
/phpstan*.neon export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/psalm*.xml export-ignore | ||
/tests/ export-ignore | ||
|
||
* text=auto eol=lf | ||
*.json text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 | ||
*.md text whitespace=blank-at-eol,blank-at-eof | ||
*.php text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 diff=php | ||
*.yml text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,113 @@ | ||
{ | ||
"name": "zircote/swagger-php", | ||
"type": "library", | ||
"license": "Apache-2.0", | ||
"bin": [ | ||
"bin/openapi" | ||
], | ||
"description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", | ||
"keywords": [ | ||
"json", | ||
"rest", | ||
"api", | ||
"service discovery" | ||
], | ||
"homepage": "https://github.com/zircote/swagger-php/", | ||
"authors": [ | ||
{ | ||
"name": "Robert Allen", | ||
"email": "zircote@gmail.com" | ||
}, | ||
{ | ||
"name": "Bob Fanger", | ||
"email": "bfanger@gmail.com", | ||
"homepage": "https://bfanger.nl" | ||
}, | ||
{ | ||
"name": "Martin Rademacher", | ||
"email": "mano@radebatz.net", | ||
"homepage": "https://radebatz.net" | ||
} | ||
], | ||
"config": { | ||
"bin-dir": "bin", | ||
"optimize-autoloader": true, | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"composer/package-versions-deprecated": true | ||
} | ||
}, | ||
"minimum-stability": "stable", | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "4.x-dev" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=7.2", | ||
"ext-json": "*", | ||
"doctrine/annotations": "^1.7", | ||
"psr/log": "^1.1 || ^2.0 || 3.0", | ||
"symfony/finder": ">=2.2", | ||
"symfony/yaml": ">=3.3" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"OpenApi\\": "src" | ||
} | ||
}, | ||
"require-dev": { | ||
"composer/package-versions-deprecated": "^1.11", | ||
"friendsofphp/php-cs-fixer": "^2.17 || ^3.0", | ||
"phpstan/phpstan": "^1.6", | ||
"phpunit/phpunit": ">=8", | ||
"vimeo/psalm": "^4.23" | ||
}, | ||
"autoload-dev": { | ||
"exclude-from-classmap": [ | ||
"/tests/Fixtures" | ||
], | ||
"psr-4": { | ||
"OpenApi\\Tests\\": "tests/", | ||
"AnotherNamespace\\": "tests/Fixtures/AnotherNamespace", | ||
"OpenApi\\Tests\\Fixtures\\Annotations\\": "tests/Fixtures/Annotations" | ||
} | ||
}, | ||
"scripts-descriptions": { | ||
"cs": "Fix all codestyle issues", | ||
"lint": "Test codestyle", | ||
"test": "Run all non-legacy and codestyle tests", | ||
"testlegacy": "Run tests using the legacy TokenAnalyser", | ||
"testall": "Run all tests (test + testlegacy)", | ||
"analyse": "Run static analysis (phpstan/psalm)", | ||
"spectral": "Run spectral lint over all .yaml files in the Examples folder", | ||
"docs:refgen": "Rebuild the annotations/attributes reference markup files", | ||
"docs:dev": "Run dev server for local development of gh-pages", | ||
"docs:build": "Re-build static gh-pages" | ||
}, | ||
"scripts": { | ||
"cs": "php-cs-fixer fix --allow-risky=yes", | ||
"lint": "@cs --dry-run", | ||
"test": [ | ||
"phpunit", | ||
"@lint" | ||
"name": "zircote/swagger-php", | ||
"type": "library", | ||
"license": "Apache-2.0", | ||
"bin": [ | ||
"bin/openapi" | ||
], | ||
"testlegacy": "export PHPUNIT_ANALYSER=legacy && phpunit", | ||
"testall": [ | ||
"@test", | ||
"@testlegacy" | ||
"description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", | ||
"keywords": [ | ||
"json", | ||
"rest", | ||
"api", | ||
"service discovery" | ||
], | ||
"analyse": [ | ||
"phpstan analyse --memory-limit=2G", | ||
"psalm" | ||
"homepage": "https://github.com/zircote/swagger-php/", | ||
"authors": [ | ||
{ | ||
"name": "Robert Allen", | ||
"email": "zircote@gmail.com" | ||
}, | ||
{ | ||
"name": "Bob Fanger", | ||
"email": "bfanger@gmail.com", | ||
"homepage": "https://bfanger.nl" | ||
}, | ||
{ | ||
"name": "Martin Rademacher", | ||
"email": "mano@radebatz.net", | ||
"homepage": "https://radebatz.net" | ||
} | ||
], | ||
"spectral": "for ff in `find Examples -name '*.yaml'`; do spectral lint $ff; done", | ||
"docs:refgen": "php docs/refgen.php", | ||
"docs:dev": "cd docs && npm run dev", | ||
"docs:build": [ | ||
"@docs:refgen", | ||
"cd docs && npm run build" | ||
] | ||
} | ||
"config": { | ||
"bin-dir": "bin", | ||
"optimize-autoloader": true, | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"composer/package-versions-deprecated": true | ||
} | ||
}, | ||
"minimum-stability": "stable", | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "4.x-dev" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=7.2", | ||
"ext-json": "*", | ||
"doctrine/annotations": "^1.7", | ||
"psr/log": "^1.1 || ^2.0 || 3.0", | ||
"symfony/finder": ">=2.2", | ||
"symfony/yaml": ">=3.3" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"OpenApi\\": "src" | ||
} | ||
}, | ||
"require-dev": { | ||
"composer/package-versions-deprecated": "^1.11", | ||
"friendsofphp/php-cs-fixer": "^2.17 || ^3.0", | ||
"phpstan/phpstan": "^1.6", | ||
"phpunit/phpunit": ">=8", | ||
"vimeo/psalm": "^4.23" | ||
}, | ||
"autoload-dev": { | ||
"exclude-from-classmap": [ | ||
"/tests/Fixtures" | ||
], | ||
"psr-4": { | ||
"OpenApi\\Tools\\": "tools/src/", | ||
"OpenApi\\Tests\\": "tests/", | ||
"AnotherNamespace\\": "tests/Fixtures/AnotherNamespace", | ||
"OpenApi\\Tests\\Fixtures\\Annotations\\": "tests/Fixtures/Annotations" | ||
} | ||
}, | ||
"scripts-descriptions": { | ||
"cs": "Fix all codestyle issues", | ||
"lint": "Test codestyle", | ||
"test": "Run all non-legacy and codestyle tests", | ||
"testlegacy": "Run tests using the legacy TokenAnalyser", | ||
"testall": "Run all tests (test + testlegacy)", | ||
"analyse": "Run static analysis (phpstan/psalm)", | ||
"spectral": "Run spectral lint over all .yaml files in the Examples folder", | ||
"docs:refgen": "Rebuild the annotations/attributes reference markup files", | ||
"docs:dev": "Run dev server for local development of gh-pages", | ||
"docs:build": "Re-build static gh-pages" | ||
}, | ||
"scripts": { | ||
"cs": "php-cs-fixer fix --allow-risky=yes", | ||
"lint": "@cs --dry-run", | ||
"test": [ | ||
"phpunit", | ||
"@lint" | ||
], | ||
"testlegacy": "export PHPUNIT_ANALYSER=legacy && phpunit", | ||
"testall": [ | ||
"@test", | ||
"@testlegacy" | ||
], | ||
"analyse": [ | ||
"phpstan analyse --memory-limit=2G", | ||
"psalm" | ||
], | ||
"spectral": "for ff in `find Examples -name '*.yaml'`; do spectral lint $ff; done", | ||
"docs:refgen": "php tools/refgen.php", | ||
"docs:dev": "cd docs && npm run dev", | ||
"docs:build": [ | ||
"@docs:refgen", | ||
"cd docs && npm run build" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* @license Apache 2.0 | ||
*/ | ||
|
||
namespace OpenApi\Processors; | ||
|
||
use OpenApi\Analysis; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
<?php | ||
|
||
/** | ||
* @license Apache 2.0 | ||
*/ | ||
|
||
namespace OpenApi\Processors; | ||
|
||
use OpenApi\Annotations\AbstractAnnotation; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php declare(strict_types=1); | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use OpenApi\Tools\Docs\RefGenerator; | ||
|
||
$refgen = new RefGenerator(__DIR__ . '/../'); | ||
|
||
foreach ($refgen->types() as $type) { | ||
ob_start(); | ||
|
||
echo $refgen->preamble($type); | ||
foreach ($refgen->classesForType($type) as $name => $details) { | ||
echo $refgen->formatHeader($name, $type); | ||
$method = "format{$type}Details"; | ||
echo $refgen->$method($name, $details['fqdn'], $details['filename']); | ||
} | ||
|
||
file_put_contents($refgen->docPath('reference/' . strtolower($type) . '.md'), ob_get_clean()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* @license Apache 2.0 | ||
*/ | ||
|
||
namespace OpenApi\Tools\CSFixer; | ||
|
||
use PhpCsFixer\Fixer\FixerInterface; | ||
use PhpCsFixer\Tokenizer\Tokens; | ||
|
||
abstract class AbstractFixer implements FixerInterface | ||
{ | ||
public function isCandidate(Tokens $tokens): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function isRisky(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function supports(\SplFileInfo $file): bool | ||
{ | ||
return $file->getExtension() == 'php'; | ||
} | ||
} |
Oops, something went wrong.