57 Commits

Author SHA1 Message Date
Guilhem Niot
86745ae2eb
Make ClassMetadataFactory optional 2022-09-26 09:09:27 +02:00
Emil Masiakowski
f808eafbe4
Read discriminator mapping from file configuration (#2034)
* Read discriminator mapping from file configuration

* Use more realistic test data
2022-09-25 19:56:43 +02:00
Baptiste Lafontaine
9050994bd4 The ObjectModelDescriber can support interfaces 2022-07-18 17:59:25 +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
fca94057d2 Merge remote-tracking branch 'origin/master' into constraint_groups 2022-04-13 19:43:23 +02:00
Baptiste Lafontaine
a4e8de7a75 Fixes symfony serializer being mandatory 2021-12-23 14:13:06 +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
ade4b6c17c
Merge branch 'master' into constraint_groups 2021-12-19 11:38:47 +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
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
Guilhem Niot
478fb2efe0 Merge branch 3.x 2021-08-03 10:25:50 +02:00
Fabien Salathe
74036e974a Remove dead code
Removed an unused property
2021-08-03 10:24:24 +02:00
Christopher Davis
ac7e29da21 Fix CS 2021-02-01 09:50:15 -06:00
Christopher Davis
9299c0e52e Support OpenAPI Polymorphism in ObjectModelDescriber
This is the default "symfony support" class, so seems like the right
place.
2021-02-01 08:56:31 -06:00
Guilhem Niot
ba3fe1cdfa Merge branch '3.x' 2020-12-17 00:06:17 +01:00
Guilhem Niot
3895e17fe4 Fix exposure of private/protected methods 2020-12-16 23:46:29 +01:00
Guilhem Niot
363fd26f7c Merge branch '3.x' 2020-12-10 22:28:55 +01:00
Guilhem Niot
68bf1670f3 Fix CS 2020-11-20 17:10:21 +01:00
Guilhem Niot
0912c85a0d Improve error when the items type of an array is not specified 2020-11-20 17:06:56 +01:00
Guilhem Niot
eeb4a8b90e
Fix ServerVariable management (#1694)
* Fix ServerVariable management

* Fix cs

* Apply StyleCI fixes
2020-08-11 16:44:05 +02:00
Guilhem Niot
ad4e5551f5 Merge remote-tracking branch 'origin/3.x' into HEAD 2020-07-12 15:07:56 +02:00
Guilhem Niot
8948d5418b
Add methods metadata support for models (#1678)
* Add methods metadata support for models

* fix cs
2020-07-12 14:54:39 +02:00
Guilhem Niot
d167685f42 Merge remote-tracking branch 'origin/3.x' into HEAD 2020-07-11 18:12:14 +02:00
Guilhem Niot
8e0713be53
Always use the SerializerExtractor (from the PropertyInfo component) (#1665)
* Always use the SerializerExtractor (from the PropertyInfo component)

* typo
2020-06-22 16:37:32 +02:00
Filip Benčo
d932b06bbb
Add support for compound properties (#1651)
* Add support for compound properties

* Fix CS & Tests

* Another fixing :D

* Final CS fix

* Allow complex compound properties

* cs

* Update the Upgrading guide

* Update php doc

* Add Support for Nullable properties

* Fix CS

* Fix CS

* Add Support for Nullable Types & Schemas as in OA3

* Update Nullable Property handling

* CS

* Fix tests

* Accept also nullable config for Alternative model names

* Refactor nullable refs

* Fix CS & Tests

* Another CS

* Revert "Another CS"

This reverts commit 03ada32b3263f3537d2af63f0abe79bd4a9ac0b5.

* Revert "Fix CS & Tests"

This reverts commit 369f2ccd170aebeeb9d87e9e00cba5cea62d5529.

* Revert "Refactor nullable refs"

This reverts commit 91cdf6fd0130f3ebf415de99f8a91edbc764255e.

* Revert "Revert "Refactor nullable refs""

This reverts commit 0e50fc1938ce3e620fc655a7d1e9284a9f8c24f0.

* Revert "Revert "Fix CS & Tests""

This reverts commit 228d3ca994eb4622c4db81aaa5f32845862e5616.

* Revert "Revert "Another CS""

This reverts commit a5b08dedf5bca8fb711b816c62bed2de9f1c9521.

* Improve nullable refs description

Co-authored-by: Filip Benčo <filip.benco@websupport.sk>
Co-authored-by: Guilhem Niot <guilhem.niot@gmail.com>
2020-06-16 13:11:53 +02:00
Guilhem Niot
82d766bfe4 Merge branch 'v3' 2020-05-30 18:23:49 +02:00
Guilhem Niot
dfff2476d8
Add @SerializedName support (#1636)
* Add `@SerializedName` support

* Also test `@SerializedName` on properties

* Fix tests with sf < 4.2

* Fix the tests

* Update the CHANGELOG
2020-05-30 18:08:25 +02:00
Filip Benčo
78664ef9ec
OpenApi 3 Support (#1623)
* Initial pass for OA3 upgrade

* Fix Util Tests

* Fix first batch of Unit Tests. Up to Model

* Another batch of fixed tests

* Update annotations

* Convert Model & Property Describers

* Update tests, Fix RouteDescribers, FIx additional bugs

* Another batch of updates

* Another batch of fixed Functional Tests

* Fix FunctionalTest tests

* Fix Bazinga Tests

* FIx FOS Rest

* Fix JMS TEsts & describers

* Fix all Tests

* Fix few stuff from own CR

* CS Fixes

* CS Fixes 2

* CS Fixes 3

* CS Fixes 4

* Remove collection bug

* Updates after first CRs

* CS

* Drop support for SF3

* Update the docs

* Add an upgrade guide

* misc doc fixes

* Configurable media types

* Code Style Fixes

* Don't use ::$ref for @Response and @RequestBody

* Fix upgrading guide

* Fix OA case

Co-authored-by: Filip Benčo <filip.benco@websupport.sk>
Co-authored-by: Guilhem Niot <guilhem.niot@gmail.com>
Co-authored-by: Mantis Development <mantis@users.noreply.github.com>
2020-05-28 13:19:11 +02:00
Filip Benčo
bb19ed7568 Revert ModelDescriberAwareInterface 2020-02-18 21:08:48 +01:00
Filip Benčo
90bae6738a Update after PR 2020-02-18 20:45:58 +01:00
Filip Benčo
5d8765db04 Fix codestyle 2019-12-13 22:45:32 +01:00
Filip Benčo
2de03859c0 Fix some bugs and confings 2019-12-13 22:20:13 +01:00
Filip Benčo
f9eacee3fd Add exntensible Property Describers 2019-12-13 21:40:42 +01:00
Asmir Mustafic
d6ea99420e Allow model describers on jms custom types (#1495)
* allow model describers on jms custom types

* add fallback describer

* test custom type def

* remove object_fallback describer from the container when jms is not active
2019-04-16 12:13:33 +02:00
Guilhem N
258dd2f69f
Improve exceptions message (#1502) 2019-04-12 09:35:49 +02:00
Guilhem N
2d81f9fd49
Update error message 2019-02-13 19:46:28 +01:00
Ayrton Ricardo
2ddf4362c0 Change validation to allow fields described as DateTimeInterface. 2018-12-10 14:21:09 +01:00
Guilhem Niot
76f25393c5 Fix alternative names issue 2018-11-04 12:24:45 +01:00
Guilhem N
99833189fd
Ignore Type::$nullable (#1391) 2018-08-30 01:10:36 +02:00
Guilhem N
619ae0d5ae
Support doctrine Collection (#1369) 2018-07-27 08:30:22 +02:00
Javier Spagnoletti
dbd2076921 Normalize description for classes implementing \DateTimeInterface 2018-05-04 15:22:18 -03:00
Dmytro Boiko
badcc8abdd Fixed #1276: Symfony Serializer Groups cause Exception while parsing 2018-04-05 15:54:51 +03:00
Guilhem Niot
8026ff46eb Support `@Model` in in-object annotations 2018-03-22 19:14:01 +01:00
Guilhem Niot
7d99a96cf4 Allow to change a property name 2018-02-19 21:42:56 +01:00
Guilhem N
e0ce82f8ad
Fix ObjectDescriber 2018-02-14 13:51:06 +01:00
Guilhem N
f193fdb1f1
Inject the AnnotationsReader in Model describers instead of internal classes (#1203) 2018-01-24 19:58:38 +01:00
Robert Gruber
fe9d12772b Add some missing property attributes for JMS model describer (#1196)
* Add some missing property attributes for JMS model describer

* Introduce own Swagger definition annotation reader

* Shorten annotation mapping by using merge
2018-01-24 15:20:20 +01:00
Guilhem N
73a5f104d6
Use @SWG\Parameter type when set instead of throwing (#1174)
* Add an exception

* Just use the manually defined type when set

* Update the jms model describer
2018-01-11 12:26:59 +01:00
Guilhem Niot
a4fe1f8078 Fix CS 2017-12-17 10:44:07 +01:00