Generates documentation for your REST API from annotations
Find a file
Christopher Davis da02f3ad33
Stop Model Property Description When a Schema Type or Ref is Already Defined (#1978)
* Return a Result Object from AnnotationsReader::updateDefinition

This is so we can make a decision on whether or not a schema's type or
ref has been manually defined by a user via an `@OA\Schema` annotation
as something other than an object.

If it has been defined, this bundle should not read model properties any
further as it causes errors.

I put this in AnnotationReader as it seemed the most flexible in the
long run. It could have gone in `OpenApiAnnotationsReader`, but then any
additional things added to `updateDefinition` could be left out of the
decision down the road. This is also a convenient place to decide this
once for `ObjectModelDescriber` and `JMSModelDescriber`.

* Stop Model Describer if a Schema Type or Ref Has Been Defined

Via the result object added in the previous commit.

This lets user "short circuit" the model describers by manually defining
the schema type or ref on a plain PHP object or form. For example,
a collection class could be defined like this:

    /**
     * @OA\Schema(type="array", @OA\Items(ref=@Model(type=SomeEntity::class)))
     */
     class SomeCollection implements \IteratorAggregate { }

Previously the model describer would error as it tries to merge the
`array` schema with the already defiend `object` schema. Now it will
prefer the array schema and skip reading all the properties of the
object.

* Add a Documentation Bit on Stopping Property Description

* Mark UpdateClassDefinitionResult as Internal
2022-04-30 20:28:05 +02:00
.github/workflows feat(dependencies): #1913 - upgrade symfony 60 dependencies 2021-12-21 11:29:10 +01:00
Annotation check $properties['value'] is not empty 2022-02-02 08:47:26 -08:00
Command Enable overriding server url for yaml and json export from console 2021-07-29 12:22:54 +02:00
Controller Keep server_url from Request only in RenderOpenApi 2021-07-29 12:11:10 +02:00
DependencyInjection try fix #1876 (#1919) 2021-12-11 14:32:00 +01:00
Describer Add support of inline path parameters (#1973) 2022-03-28 14:37:14 +02:00
Exception Update outdated swagger annotations namespace (#1898) 2021-11-03 23:55:56 +01:00
Form/Extension Allow to not document form types fields (#1752) 2020-12-02 15:38:38 +01:00
Model Improve "no describer found" error message (#1979) 2022-04-13 19:54:31 +02:00
ModelDescriber Stop Model Property Description When a Schema Type or Ref is Already Defined (#1978) 2022-04-30 20:28:05 +02:00
OpenApiPhp Reproduce and fix duplicate operation id errors (#1972) 2022-03-28 14:36:03 +02:00
PropertyDescriber Add support for zircore/swagger-php 4.0 (#1916) 2021-12-11 14:39:04 +01:00
Render fixed : add doc blocks to silence Symfony deprecations (#1922) 2021-12-11 13:58:33 +01:00
Resources Stop Model Property Description When a Schema Type or Ref is Already Defined (#1978) 2022-04-30 20:28:05 +02:00
RouteDescriber Add support for php attributes (#1932) 2021-12-21 16:16:14 +01:00
Routing Add support for php attributes (#1932) 2021-12-21 16:16:14 +01:00
Tests Stop Model Property Description When a Schema Type or Ref is Already Defined (#1978) 2022-04-30 20:28:05 +02:00
Util CS 2022-03-21 17:04:37 +01:00
.gitattributes Exclude development files from dist package 2020-09-28 10:36:17 -03:00
.gitignore Add support for php attributes (#1932) 2021-12-21 16:16:14 +01:00
.php_cs.dist Fix build travis 2019-11-20 12:15:00 +01:00
.styleci.yml Update StyleCI config 2020-08-06 10:25:35 +02:00
.symfony.bundle.yaml Change in a config file 2021-03-23 14:29:59 +01:00
ApiDocGenerator.php Reproduce and fix duplicate operation id errors (#1972) 2022-03-28 14:36:03 +02:00
CHANGELOG.md Release version 3.7 2020-08-12 11:06:17 +02:00
composer.json Create an enum model describer (#1965) 2022-04-04 11:42:44 +02:00
CONTRIBUTING.md Add php 8 support (#1745) 2020-12-10 21:59:36 +01:00
LICENSE Change the vendor to "Nelmio" 2016-12-29 12:09:26 +01:00
NelmioApiDocBundle.php Add areas support (#1169) 2018-01-05 13:08:02 +01:00
phpunit Add php 8 support (#1745) 2020-12-10 21:59:36 +01:00
phpunit.bat Fix Declaration must be compatible error with tests (#1638) 2020-05-31 15:16:51 +02:00
phpunit.xml.dist Let PHPUnit fail on warnings and risky tests 2021-03-14 17:18:13 +01:00
README.md Merge branch '3.x' 2020-12-29 10:30:06 +01:00
update-js.sh Include map files 2017-06-22 21:22:10 +02:00
UPGRADE-3.0.md Add exceptions in the upgrading command to warn about the requirement to run it on 2.x (#1501) 2019-04-11 20:54:16 +02:00
UPGRADE-4.0.md Update link to zircote/swagger-php upgrade documentation 2022-02-28 11:54:53 +01:00

NelmioApiDocBundle

Build Status Total Downloads Latest Stable
Version

The NelmioApiDocBundle bundle allows you to generate a decent documentation for your APIs.

Migrate from 3.x to 4.0

To migrate from 3.x to 4.0, follow our guide.

Version 4.0 brings OpenAPI 3.0 support. If you want to stick to Swagger 2.0, you should use the version 3 of this bundle.

Migrate from 2.x to 3.0

To migrate from 2.x to 3.0, follow our guide.

Installation

Open a command console, enter your project directory and execute the following command to download the latest version of this bundle:

composer require nelmio/api-doc-bundle

Documentation

Read the documentation on symfony.com

Contributing

See CONTRIBUTING file.

Running the Tests

Install the Composer dependencies:

git clone https://github.com/nelmio/NelmioApiDocBundle.git
cd NelmioApiDocBundle
composer update

Then run the test suite:

./phpunit

License

This bundle is released under the MIT license.