justcoded/yii2-swaggerviewer

This package is abandoned and no longer maintained. No replacement package was suggested.

Swagger viewer for multi-document yaml specs

dev-master 2018-05-11 13:40 UTC

This package is auto-updated.

Last update: 2023-09-21 01:09:48 UTC


README

Viewer of a separate yaml/json swagger docs. Include swagger multi-doc merger, so you can format your docs in multiple files for faster edits.

This package is based on our SwaggerTools pack.

Example of docs to view can be found here: SwaggerTools docs example

As extra feature, you can provide additional properties to generate enums, which are usually used by mock servers to generate test responses. We recommend Prism mock server. If you specify correct validation rules (like minimum, maximum, minItems, maxItems, etc.) it will generate nice mocks with data generated by faker php lib.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist justcoded/yii2-swaggerviewer "*"

or add

"justcoded/yii2-swaggerviewer": "*"

to the require section of your composer.json file.

Configuration

Add module to your web config file:

	'modules' => [
		'swagger' => [
			'class' => \justcoded\yii2\swaggerviewer\Module::class,
			'docsPath' => '@app/docs/swagger/swagger.yaml',

			// use merger tool. if you have single file - can turn it off for faster load.
			'multiDoc' => true,
			
			// enable faker tool. additional link will be provided to download fakered copy.
			'fakerCopy' => true,
			'fakerNum'  => 10, // number of items to generate
		],
	],