314 Commits

Author SHA1 Message Date
Guilhem Niot
ca6577d420 Fix tests 2022-09-25 19:23:47 +02:00
Guilhem Niot
84973d52f5 Fix api-platform tests 2022-09-25 19:21:32 +02:00
Guilhem Niot
fd45120d5c
Catch more precise exception in DocumentationController (#2027)
* Catch more precise exception in DocumentationController

* cs

* Fix tests
2022-09-03 13:18:46 +02:00
Guilhem Niot
766ed898cf
Make Model Attachable (#2025)
* Make Model Attachable

* fix cs

* Drop zircote/swagger-php < 4.2 support
2022-09-03 12:49:49 +02:00
Guilhem Niot
3183a2bffe
Update UtilTest.php 2022-09-03 12:40:23 +02:00
Baptiste Lafontaine
9050994bd4 The ObjectModelDescriber can support interfaces 2022-07-18 17:59:25 +02:00
Christopher Davis
235963df41
Merge pull request #1902 from chrisguitarguy/constraint_groups
Respect Constraint Validation Groups When Describing Models
2022-06-10 16:15:42 -05:00
Guilhem Niot
a6f25da106
Detect when a model is used for a form type (#1834)
* Detect when a model is used for a form type

* typo

* Add a test + Fix implementation

* CS
2022-06-10 22:41:24 +02:00
Guilhem Niot
be8499ffdc
Merge pull request #1988 from nelmio/ROOTCONTEXT
Use the same root context everywhere
2022-06-10 20:52:06 +02:00
Christopher Davis
6b2ef45b24 Merge remote-tracking branch 'origin/master' into constraint_groups 2022-05-11 08:18:52 -05:00
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
Guilhem Niot
cb03d99c97 Remote Context::root() usage 2022-04-30 20:20:38 +02:00
Guilhem Niot
5d747aefc3 fix CS 2022-04-30 20:10:00 +02:00
Guilhem Niot
52e7fc4de1 Use the same root context everywhere 2022-04-30 20:07:44 +02:00
Guilhem Niot
f8c030d096
Improve "no describer found" error message (#1979) 2022-04-13 19:54:31 +02:00
Guilhem Niot
fca94057d2 Merge remote-tracking branch 'origin/master' into constraint_groups 2022-04-13 19:43:23 +02:00
Baptiste Lafontaine
1302bc7568
Create an enum model describer (#1965)
* Create an enum model describer

* Bump Api-Platform

Co-authored-by: Guilhem Niot <guilhem@gniot.fr>
2022-04-04 11:42:44 +02:00
Guilhem Niot
2295f68b89
Add support of inline path parameters (#1973)
* Add support of inline path parameters

* Fix CS
2022-03-28 14:37:14 +02:00
Guilhem Niot
8111ce645b
Reproduce and fix duplicate operation id errors (#1972)
* Replicate and fix duplicate operation id errors

* Fix CS
2022-03-28 14:36:03 +02:00
Guilhem Niot
e722f642ad Fix the tests 2022-03-21 17:03:22 +01:00
Jack Cutting
9545a0ce52 Allow security policies to be removed using the Security annotation by passing it a name of null. 2022-01-26 17:33:35 +00:00
Guilhem Niot
e0b25e5580 zircote/swagger-php attributes were moved to Attributes namespace 2022-01-10 17:08:13 +01:00
Guilhem Niot
43212d9b7e Context::getRootContext() was removed 2022-01-10 16:50:45 +01:00
Guilhem Niot
ced932b8e7
Test more PHP 8.1 attributes support (#1936)
* Test `@Areas` as a php 8.1 attribute

* Test `@Security` as PHP 8.1 attribute
2021-12-21 16:39:08 +01:00
Alex Kalineskou
cc97b0ba45
Add support for php attributes (#1932)
* Add support for php attributes

* Fix tests for php 8.1

* Simplify the annotations

* Revert the changes to the tests

* CS

* Test FOSRest parsing of attributes

* CS

* typo

* CS

* Test fetchArticle php 8.1 attributes

* Fix namespaces

Co-authored-by: Guilhem Niot <guilhem@gniot.fr>
2021-12-21 16:16:14 +01:00
Guilhem Niot
ab99b4bcb9 Fix api-platform routes import 2021-12-21 13:52:16 +01:00
Guilhem Niot
0fada289f5 Fix CS 2021-12-21 13:46:02 +01:00
Guilhem Niot
b4c74ee938 Fix retrieval of container in tests 2021-12-21 13:41:49 +01:00
Fabiano Roberto
e04521ebea Fix usage of configureRoutes in tests 2021-12-21 11:54:39 +01:00
Guilhem Niot
b399cb4c7e
fix tests 2021-12-19 11:41:36 +01:00
Guilhem Niot
ade4b6c17c
Merge branch 'master' into constraint_groups 2021-12-19 11:38:47 +01:00
Alexey Alshenetsky
7de49bb4a8
Add missing null check to ControllerReflector::getReflectionMethod (#1918)
* add null check

https://github.com/nelmio/NelmioApiDocBundle/issues/1909

* less code is better

* add tests for ControllerReflection::getReflectionMethod()

* lint fix

* style_ci fixes

Co-authored-by: Alexey <alshenestky@icloud.com>
2021-12-12 01:32:51 +01:00
Alexey Alshenetsky
14383f4ee5
Add support for zircore/swagger-php 4.0 (#1916)
* add zircore/swagger-php v4 to composer.json

* fix incompatibilities

* add compatibility with 3.2

* Apply fixes from StyleCI

* mark SetsContextTrait as internal

* Bump php version

Co-authored-by: Alexey <alshenestky@icloud.com>
Co-authored-by: Alexey Alshenetsky <alshenetsky@users.noreply.github.com>
Co-authored-by: Guilhem Niot <guilhem@gniot.fr>
2021-12-11 14:39:04 +01:00
Guilhem Niot
a184cb8ef4
Fix deprecations (#1923) 2021-12-11 14:19:43 +01:00
Guilhem Niot
82bb3cb916
Fix usage of getCollectionValueTypes and getCollectionKeyTypes (#1910)
* Fix usage of getCollectionValueTypes and getCollectionKeyTypes

* fix cs
2021-11-30 13:06:32 +01:00
Vladislav
d59dbbd859
Issue 1848 operation id by route name (#1907)
* Fix #1885 update psr/log and psr/container

* Issue #1848 operation id by route name

Co-authored-by: Vlad Gaiduk <uahaiduk@gmail.com>
2021-11-22 20:18:16 +01:00
Christopher Davis
1e45fdf1d6 Fix a Named Parameter on PHP 8 2021-11-06 07:42:38 -05:00
Christopher Davis
10d6d57ca7 Remove Some Trailing Comma 2021-11-06 07:42:38 -05:00
Christopher Davis
477442588a Fix CS 2021-11-06 07:42:38 -05:00
Christopher Davis
7357de9c16 Add a Configuration Option to Enable Validation Groups
If this was turned on by default, that seems like a _large_ BC break as
folks entire OpenAPI doc could change underneath them.

The config option defaults to false and users can enable it if they
desire.
2021-11-06 07:13:56 -05:00
Christopher Davis
cc962b72c8 Add Validation Group Support to SymfonyConstraintAnnotationReader
This support is gated behind a flag as turning it on seems like it would
be a large backwards incompatible change.
2021-11-06 07:13:41 -05:00
Guilhem Niot
e16d1fedb9 Fix CS 2021-11-04 00:09:07 +01:00
Guilhem Niot
200ec0fdcb Merge branch '3.x' 2021-11-04 00:06:42 +01:00
Samaël tomas
efa83ca54e
Fix OpenApiRenderer list could be null (#1881)
Co-authored-by: Samael tomas <samael.tomas@wizbii.com>
2021-10-19 14:29:11 +02:00
Frederik Holz
aa18c6c83b
[3.x]: Hide the default section per area with new config parameter (#1868)
* Add new config node disable_default_routes to prevent registering RouteDescriber to specific areas which allowes disabling rendering of default routes, Adjust tests accordingly

* Add documentation for new config variable

* Change disable_default_routes to filter route collection instead of disabling route describer, Add test for new handling in FilteredRouteCollectionBuilder

* Change naming of matching method for disabling default routes

* Fix codestyle issue

* Fix codestyle issue

* Change naming of dataProvider to match testing name

Co-authored-by: Frederik Holz <team-orange@auxmoney.com>
2021-10-06 19:28:59 +02:00
Guilhem Niot
9c729ab7b7
Fix support without twig (#1878)
* fix support without twig

* Support null openApiRenderer

* Register a twig extension instead of registering twig function at runtime

* fix tests
2021-09-22 23:43:32 +02:00
Zdeněk Drahoš
1a21f1855e Enable overriding server url for yaml and json export from console 2021-07-29 12:22:54 +02:00
Zdeněk Drahoš
1b9be28ad6 Enable dumping docs to yaml 2021-07-29 11:57:00 +02:00
Zdeněk Drahoš
2c890ff93b Hotfix testing private service in Symfony < 5.3
https://github.com/nelmio/NelmioApiDocBundle/runs/3031148906?check_suite_focus=true#step:7:106
Error: Call to undefined method Nelmio\ApiDocBundle\Tests\Render\Html\GetNelmioAssetTest::getContainer()

https://symfony.com/blog/new-in-symfony-4-1-simpler-service-testing
In practice, tests based on WebTestCase and KernelTestCase now access to a special container via the static::$container property that allows fetching non-removed private services:

https://github.com/symfony/symfony/blob/5.3/CHANGELOG-5.3.md#changelog-for-53x
feature #40366 [FrameworkBundle] Add KernelTestCase::getContainer() (Nyholm)
static $container @deprecated since Symfony 5.3, use static::getContainer() instead
2021-07-10 18:00:11 +02:00
Zdeněk Drahoš
9cb6006b69 Refactoring including assets 2021-06-27 10:00:43 +02:00