NelmioApiDocBundle/Tests
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
..
Command Enable overriding server url for yaml and json export from console 2021-07-29 12:22:54 +02:00
DependencyInjection Merge branch '3.x' 2021-11-04 00:06:42 +01:00
Describer Add php 8 support (#1745) 2020-12-10 21:59:36 +01:00
Functional Stop Model Property Description When a Schema Type or Ref is Already Defined (#1978) 2022-04-30 20:28:05 +02:00
Model Improve "no describer found" error message (#1979) 2022-04-13 19:54:31 +02:00
ModelDescriber zircote/swagger-php attributes were moved to Attributes namespace 2022-01-10 17:08:13 +01:00
Render Fix retrieval of container in tests 2021-12-21 13:41:49 +01:00
RouteDescriber Fix access to api->components in RouteMetadataDescriber (#1635) 2020-05-30 18:24:51 +02:00
Routing Test more PHP 8.1 attributes support (#1936) 2021-12-21 16:39:08 +01:00
SwaggerPhp Context::getRootContext() was removed 2022-01-10 16:50:45 +01:00
Util Add missing null check to ControllerReflector::getReflectionMethod (#1918) 2021-12-12 01:32:51 +01:00
ApiDocGeneratorTest.php Move the OpenApi processing to ApiDocGenerator (#1671) 2020-07-06 19:50:34 +02:00
Helper.php Compound validation rule support (#1818) 2021-06-16 09:59:06 +02:00