Download the PHP package avency/neos-openapi without Composer
On this page you can find all versions of the php package avency/neos-openapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download avency/neos-openapi
More information about avency/neos-openapi
Files in avency/neos-openapi
Package neos-openapi
Short Description OpenApi Basic package with swagger ui rendering
License MIT
Homepage https://github.com/avency/Avency.Neos.OpenApi
Informations about the package neos-openapi
Avency Neos OpenAPI
This package contains basics to generate an interactive OpenAPI documentation for a RESTful API using doctrine annotations.
It contains a controller that renders a swagger ui and which gets its input from a json-file generated based on the OpenAPI annotations in the projects' files.
It uses the sintbert/swagger-php
package.
Calling the documentation
Backend
There is a backend module accessible as administrator, which renders the swagger UI.
Frontend
To call the documentation in the frontend, you need to be logged in in the backend as administrator. Then you can call the api:
To access just the generated json which is used to fill the Swagger UI, you can directly call the json file:
Writing the documentation
Files to consider for documentation
There is the possibility to specify the folder(s), which need to be considered for generating the documentation. The default is set to
To change this, just change the Settings:
Import Statement
All files in which Annotations for the Documentation are added need to use the following statement
Annotations
Info
Need to be added in a separate file and contains general information about the api for example:
Tag
A tag serves as group in which the different api endpoints can be grouped in.
It should be defined in top of the distinct controllers.
The tag can be referenced in the different operations.
Operations
There are different operations available to describe the different api endpoints, like @OA\Get
, @OA\Post
, @OA\Put
or @OA\Delete
.
They should be each defined in the method description.
They contain a path
, a brief summary
and a description
. @OA\Parameters
can be added, if the url accepts parameters. The @OA\Response
defines the different response codes.
Schema
The schema describes a representation of a model.
The annotation should be added on the domain model. The schema
-attribute is taken by the class name, but can be overwritten or set, if a special schema is defined outside of a domain model.
They contain a title
and a brief description
. If necessary, special @OA\Property
values can be defined, if the schema should represent more than the in the class defined variables, like the identifier.
Property
The property describes a single property in a model. The annotation should be added close to the property.
Some information about type does not need to be explicitly defined but is for example taken from the type of the property.
It is also possible to refer to other Schema objects. This will be also detected by the property type, if there is an other schema for this type.
References can be also added manually.
More Information
Other parameters or annotations are available. More information can be found on the OpenAPI Specification website:
https://swagger.io/specification/
License
The MIT License (MIT). Please see License File for more information.