Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mako-framework/open-api

Generate routes based on OpenAPI specifications and OpenAPI specifications from code.
https://github.com/mako-framework/open-api

mako-framework mako-package openapi redoc swagger swagger-ui

Last synced: about 1 month ago
JSON representation

Generate routes based on OpenAPI specifications and OpenAPI specifications from code.

Awesome Lists containing this project

README

        

# OpenApi

[![Static analysis](https://github.com/mako-framework/open-api/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/mako-framework/open-api/actions/workflows/static-analysis.yml)

The `mako/open-api` package allows you to generate a [OpenApi](https://www.openapis.org) specification using [attributes](https://www.php.net/manual/en/language.attributes.php) or docblock annotations and to generate routes based on the specification.

## Requirements

Mako 10.0 or greater.

## Installation

First you'll need to install the package as a dependency to your project.

```
composer require mako/open-api
```

Next you'll need to add the package to the `cli` section of the `packages` configuration array in the `application.php` config file.

```
'cli' =>
[
mako\openapi\OpenApiPackage::class,
]
```

And finally replace the contents of your `routes.php` file with the following:

```php
Note that you have to set the `operationId` parameter to the fully qualified method name (e.g. app\controllers\Index::welcome) of your controller action for the route generator to work.

```
openapi: 3.0.2
info:
title: Mako
version: 1.0.0
description: Mako example application.
paths:
'/':
summary: Displays a welcome page.
get:
operationId: 'app\controllers\Index::welcome'
```