From 88ab3851008b1b5b2237af9c9fce056b0a0ceb9f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 5 Jul 2024 16:08:01 +0200 Subject: [PATCH] test openapi --- app/Http/Controllers/Api/OpenApi.php | 16 ++++ app/Http/Controllers/Api/TeamController.php | 31 ++++++++ composer.json | 3 +- composer.lock | 83 ++++++++++++++++++++- openapi.yaml | 55 ++++++++++++++ 5 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 app/Http/Controllers/Api/OpenApi.php create mode 100644 openapi.yaml diff --git a/app/Http/Controllers/Api/OpenApi.php b/app/Http/Controllers/Api/OpenApi.php new file mode 100644 index 000000000..0878238f0 --- /dev/null +++ b/app/Http/Controllers/Api/OpenApi.php @@ -0,0 +1,16 @@ +id; diff --git a/composer.json b/composer.json index 3603b936e..9991931d5 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,8 @@ "stripe/stripe-php": "^12.0", "symfony/yaml": "^6.2", "visus/cuid2": "^2.0.0", - "yosymfony/toml": "^1.0" + "yosymfony/toml": "^1.0", + "zircote/swagger-php": "^4.10" }, "require-dev": { "fakerphp/faker": "^v1.21.0", diff --git a/composer.lock b/composer.lock index 23d7d2e13..09492fd31 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "168e351cec87acbea9c1c745b83eead2", + "content-hash": "ec2082fff21212c016bfd6ffd13f8249", "packages": [ { "name": "amphp/amp", @@ -12348,6 +12348,87 @@ } ], "time": "2023-05-30T22:51:52+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "4.10.3", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998", + "reference": "ad3f913d39b2a4dfb6e59ee4babb35a6b4a2b998", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=7.2", + "psr/log": "^1.1 || ^2.0 || ^3.0", + "symfony/deprecation-contracts": "^2 || ^3", + "symfony/finder": ">=2.2", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "composer/package-versions-deprecated": "^1.11", + "doctrine/annotations": "^1.7 || ^2.0", + "friendsofphp/php-cs-fixer": "^2.17 || ^3.47.1", + "phpstan/phpstan": "^1.6", + "phpunit/phpunit": ">=8", + "vimeo/psalm": "^4.23" + }, + "suggest": { + "doctrine/annotations": "^1.7 || ^2.0" + }, + "bin": [ + "bin/openapi" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "OpenApi\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "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" + } + ], + "description": "swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "support": { + "issues": "https://github.com/zircote/swagger-php/issues", + "source": "https://github.com/zircote/swagger-php/tree/4.10.3" + }, + "time": "2024-07-04T07:53:11+00:00" } ], "packages-dev": [ diff --git a/openapi.yaml b/openapi.yaml new file mode 100644 index 000000000..f2a813c19 --- /dev/null +++ b/openapi.yaml @@ -0,0 +1,55 @@ +openapi: 3.0.0 +info: + title: Coolify + version: '0.1' +servers: + - + url: 'https://coolify.io/api/v1' +paths: + /teams: + get: + operationId: f9c530b5b25df9601cb87d6a58646f0a + responses: + '200': + description: 'List of teams' + '401': + description: Unauthorized + '/teams/{id}': + get: + operationId: ac57ff546c002032cef44602c46a4e76 + parameters: + - + name: id + in: path + description: 'Team ID' + required: true + schema: + type: integer + responses: + '401': + description: Unauthorized + content: + application/json: + schema: + properties: + message: { type: string, example: Unauthenticated. } + type: object + '404': + description: 'Team not found' + '200': + description: 'Team model' + content: + application/json: + schema: + properties: + id: { type: integer, example: 1 } + name: { type: string, example: 'Team 1' } + created_at: { type: string, format: date-time, example: '2021-10-10T10:00:00Z' } + updated_at: { type: string, format: date-time, example: '2021-10-10T10:00:00Z' } + type: object +components: + securitySchemes: + bearerAuth: + type: http + bearerFormat: JWT + scheme: bearer