diff --git a/.docs/README.md b/.docs/README.md
deleted file mode 100644
index 52fc6e6..0000000
--- a/.docs/README.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# Contributte OpenApi
-
-Pure PHP OpenAPI 3.0 implementation for Nette Framework.
-
-## Content
-
-- [Setup](#setup)
-- [OpenAPI](#tracy)
-- [Tracy](#tracy)
-
-## Setup
-
-Install package
-
-```bash
-composer require contributte/openapi
-```
-
-## OpenAPI
-
-- [Callback.php](../src/Schema/Callback.php)
-- [Components.php](../src/Schema/Components.php)
-- [Contact.php](../src/Schema/Contact.php)
-- [Example.php](../src/Schema/Example.php)
-- [ExternalDocumentation.php](../src/Schema/ExternalDocumentation.php)
-- [Header.php](../src/Schema/Header.php)
-- [Info.php](../src/Schema/Info.php)
-- [License.php](../src/Schema/License.php)
-- [Link.php](../src/Schema/Link.php)
-- [MediaType.php](../src/Schema/MediaType.php)
-- [OAuthFlow.php](../src/Schema/OAuthFlow.php)
-- [OpenApi.php](../src/Schema/OpenApi.php)
-- [Operation.php](../src/Schema/Operation.php)
-- [Parameter.php](../src/Schema/Parameter.php)
-- [PathItem.php](../src/Schema/PathItem.php)
-- [Paths.php](../src/Schema/Paths.php)
-- [Reference.php](../src/Schema/Reference.php)
-- [RequestBody.php](../src/Schema/RequestBody.php)
-- [Response.php](../src/Schema/Response.php)
-- [Responses.php](../src/Schema/Responses.php)
-- [Schema.php](../src/Schema/Schema.php)
-- [SecurityRequirement.php](../src/Schema/SecurityRequirement.php)
-- [SecurityScheme.php](../src/Schema/SecurityScheme.php)
-- [Server.php](../src/Schema/Server.php)
-- [ServerVariable.php](../src/Schema/ServerVariable.php)
-- [Tag.php](../src/Schema/Tag.php)
-
-## Tracy
-
-
-
-```neon
-services:
- swaggerPanel:
- class: Contributte\OpenApi\Tracy\SwaggerPanel()
- setup:
- - setSpec([...openapi])
- - setLazySpec([@openapi, getSpec])
- - setUrl('https://petstore.swagger.io/v2/swagger.json')
- - setExpansion()
- - setFilter("role=User")
- - setTitle(MyAPI)
-
-tracy:
- bar:
- - @swaggerPanel
-```
diff --git a/README.md b/README.md
index d762ffd..ba0d516 100644
--- a/README.md
+++ b/README.md
@@ -12,36 +12,115 @@
-
+
Website 🚀 contributte.org | Contact 👨🏻💻 f3l1x.io | Twitter 🐦 @contributte
-## Usage +Pure PHP OpenAPI 3.0 implementation for Nette Framework. + +## Versions + +| State | Version | Branch | Nette | PHP | +|--------|---------|----------|-------|---------| +| dev | `^0.2` | `master` | 4.0+ | `>=8.2` | +| stable | `^0.1` | `master` | 4.0+ | `>=8.1` | + +## Installation To install the latest version of `contributte/openapi` use [Composer](https://getcomposer.org). -``` +```bash composer require contributte/openapi ``` -## Documentation +## Usage + +Create a document with schema objects and export it through `toArray()`. + +```php +use Contributte\OpenApi\Schema\Info; +use Contributte\OpenApi\Schema\OpenApi; +use Contributte\OpenApi\Schema\Operation; +use Contributte\OpenApi\Schema\PathItem; +use Contributte\OpenApi\Schema\Paths; +use Contributte\OpenApi\Schema\Response; +use Contributte\OpenApi\Schema\Responses; + +$responses = new Responses(); +$responses->setResponse('200', new Response('OK')); + +$operation = new Operation($responses); +$operation->setSummary('List users'); + +$path = new PathItem(); +$path->setOperation(PathItem::OPERATION_GET, $operation); + +$paths = new Paths(); +$paths->setPathItem('/users', $path); + +$openApi = new OpenApi('3.0.3', new Info('My API', '1.0.0'), $paths); + +header('Content-Type: application/json'); +echo json_encode($openApi->toArray(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); +``` + +## OpenAPI + +- [Callback.php](src/Schema/Callback.php) +- [Components.php](src/Schema/Components.php) +- [Contact.php](src/Schema/Contact.php) +- [Example.php](src/Schema/Example.php) +- [ExternalDocumentation.php](src/Schema/ExternalDocumentation.php) +- [Header.php](src/Schema/Header.php) +- [Info.php](src/Schema/Info.php) +- [License.php](src/Schema/License.php) +- [Link.php](src/Schema/Link.php) +- [MediaType.php](src/Schema/MediaType.php) +- [OAuthFlow.php](src/Schema/OAuthFlow.php) +- [OpenApi.php](src/Schema/OpenApi.php) +- [Operation.php](src/Schema/Operation.php) +- [Parameter.php](src/Schema/Parameter.php) +- [PathItem.php](src/Schema/PathItem.php) +- [Paths.php](src/Schema/Paths.php) +- [Reference.php](src/Schema/Reference.php) +- [RequestBody.php](src/Schema/RequestBody.php) +- [Response.php](src/Schema/Response.php) +- [Responses.php](src/Schema/Responses.php) +- [Schema.php](src/Schema/Schema.php) +- [SecurityRequirement.php](src/Schema/SecurityRequirement.php) +- [SecurityScheme.php](src/Schema/SecurityScheme.php) +- [Server.php](src/Schema/Server.php) +- [ServerVariable.php](src/Schema/ServerVariable.php) +- [Tag.php](src/Schema/Tag.php) -For details on how to use this package, check out our [documentation](.docs). +## Tracy -## Version + -| State | Version | Branch | Nette | PHP | -|-------------|---------|----------|------|---------| -| dev | `^0.2` | `master` | 4.0+ | `>=8.2` | -| stable | `^0.1` | `master` | 4.0+ | `>=8.1` | +```neon +services: + swaggerPanel: + class: Contributte\OpenApi\Tracy\SwaggerPanel() + setup: + - setSpec([...openapi]) + - setLazySpec([@openapi, getSpec]) + - setUrl('https://petstore.swagger.io/v2/swagger.json') + - setExpansion() + - setFilter("role=User") + - setTitle(MyAPI) + +tracy: + bar: + - @swaggerPanel +``` ## Development See [how to contribute](https://contributte.org/contributing.html) to this package. -This package is currently maintaining by these authors. +This package is currently maintained by these authors.