613 Commits

Author SHA1 Message Date
Thomas Lallement
7f9b00d620 Code improvements and add unit test 2021-03-16 10:40:12 +01:00
Thomas Lallement
f2c75ebc9d
Fix Open API doc for DateTime requirements
When using the following requierement:

```
@Rest\QueryParam(name="updatedFrom", strict=true, nullable=true, requirements=@Constraints\DateTime("Y-m-d\TH:i:s"))
```

According to the OpenAPI 3.0 documentation https://swagger.io/specification/, we should have "format": "date-time" rather than "format": "DateTime" in the generated doc
2021-03-11 19:06:17 +01:00
Dmitry Pchelintsev
8f646b8484
allow areas annotation for controller class (#1528)
Co-authored-by: pchol <spchols@gmail.com>
Co-authored-by: Guilhem Niot <guilhem@gniot.fr>
2021-03-03 20:47:08 +01:00
Christopher Davis
883d7b6c89
Apply enum from Choice Constraints to Items When Choice is Multiple (#1784)
* Apply `enum` from Choice Constraints to Items When Choice is Multiple

Otherwise JSON schema like this is generated:

```
"property": {
  "type": "array",
  "enum": ["one", "two", "three"],
  "items": {
    "type": "string"
  }
}
```

With this change, however, this schema is generated:

```
"property": {
  "type": "array",
  "items": {
    "type": "string",
    "enum": ["one", "two", "three"]
  }
}
```

A possible downside here is that the symfony constraint stuff happens
before types are figured out from PHPDoc. So it's _possible_ to end up
with something that won't validated. Take something like this:

```
/**
 * @Assert\Choice(multiple=true, choices={"..."})
 * @var string
 */
```

This would generate:

```
"property": {
  "type": "string",
  "items": {
    "enum": ["..."]
  }
}
```

* Fix CS

* cs

* more cs

* fix tests

Co-authored-by: Guilhem Niot <guilhem@gniot.fr>
2021-02-19 09:41:32 +01:00
Guilhem Niot
ceda09fe85
Merge pull request #1781 from chrisguitarguy/fix_lengths
Check Min and Max in Length Constraints Before Setting in Schemas
2021-02-16 01:03:59 +01:00
Guilhem Niot
d074e05436
Merge pull request #1777 from saleh199/add_yaml_doc
Add Yaml Documentation
2021-02-16 01:01:33 +01:00
Christopher Davis
530311c489 Check Min and Max in Length Constraints Before Setting in Schemas
Sometimes folks will set a `min` length without a max, for instance and
the generated open api schema would previously have been nonsense:

```
"property": {
  "type":"string",
  "maxLength":0,
  "minLength":1
}
```
2021-02-10 10:33:55 -06:00
Saleh Saeed
774057a91a
Revert DocumentationController name 2021-02-08 22:54:21 +01:00
Guilhem Niot
1b4437d88a
Merge pull request #1776 from chrisguitarguy/discriminator_field
Support Polymorphism via the Symfony Discriminator Map
2021-02-08 22:46:49 +01:00
Christopher Davis
87004fc428 Don't Use ref in Discriminator mapping
Instead just include the schema ref directly per the documentation.
2021-02-08 15:39:14 -06:00
Guilhem Niot
1913b1ab23
Merge pull request #1774 from illuin-tech/master
Support oauth2 scopes in Security annotation
2021-02-08 22:17:01 +01:00
Saleh Saeed
2b387e80f2 Fix styleci 2021-02-01 23:34:02 +01:00
Saleh Saeed
46ef005787 Add Yaml Documentation
Fixes #1613
2021-02-01 23:29:53 +01: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
Christopher Davis
d8626c2735 Introduce a Trait to Build OpenAPI Discriminators
See https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/

This is the adapter layer that will be included in the various model
describers. The creation of the discriminator and the `oneOf` values is
a little finicky and I wanted it to be tested and centralized.
2021-02-01 08:37:20 -06:00
Paul des Garets
eeb0b4efba Support oauth2 scopes in Security annotation 2021-01-26 19:08:53 +01:00
Guilhem Niot
306aba97a4 Merge #1769 2020-12-30 00:15:43 +01:00
Guilhem Niot
bc2b3f7530 Merge branch '3.x' 2020-12-29 10:30:06 +01:00
Guilhem Niot
e57ede23ed Use annotations reader without cache 2020-12-29 10:27:09 +01:00
Guilhem Niot
42365c71cc Fix a regression about manual paths in operation no longer being taken into account 2020-12-27 19:14:14 +01:00
Guilhem Niot
820c058de7
Update build status with github actions 2020-12-22 11:27:56 +01: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
76c6f05023 Use stable version of FOSRestBundle 2020-12-16 21:31:45 +01:00
Guilhem Niot
a9e8db4af0
Fix the tests (#1761)
* Bump phpunit-bridge

* Bump many dependencies
2020-12-10 23:00:21 +01:00
Guilhem Niot
85978ad800 Fix github actions 2020-12-10 22:40:50 +01:00
Guilhem Niot
18c040b1c4 Add master branch to git actions workflow 2020-12-10 22:32:53 +01:00
Guilhem Niot
909a7934b4 Merge branch '3.x' 2020-12-10 22:31:55 +01:00
Guilhem Niot
0a3785fd26 Fix cs 2020-12-10 22:30:50 +01:00
Guilhem Niot
363fd26f7c Merge branch '3.x' 2020-12-10 22:28:55 +01:00
Guilhem Niot
6d995a6e03
Add php 8 support (#1745)
* Add php 8 support

* Ignore platform reqs

* Change php constraint

* Use vendor/bin/simple-phpunit directly

* Remove willdurand/hateoas-bundle when testing php8

* Merge 3.x

* Move to github actions

* Fix the tests

* Change ./phpunit permissions

* Update deprecations policy
2020-12-10 21:59:36 +01:00
Guilhem Niot
67b28f1f7f
Allow the usage of @SWG\Definition on form types (#1751) 2020-12-02 15:39:15 +01:00
Guilhem Niot
90f835f1ef
Allow to not document form types fields (#1752)
* Allow the usage of `@SWG\Definition` on form types

* Allow to not document form types fields

* Reduce the number of changes
2020-12-02 15:38:38 +01:00
Guilhem Niot
f60724e90a
Merge pull request #1747 from nelmio/arrayitemserror
Improve error when the items type of an array is not specified
2020-11-28 18:34:49 +01:00
Guilhem Niot
a01fd1e4f0 Fix error 2020-11-28 16:11:05 +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
e9914097f7
Merge pull request #1740 from nelmio/refparams
Fix the detection of references in the RouteMetadataDescriber
2020-11-03 10:32:13 +01:00
Guilhem Niot
412eff9805 Test the support of QueryParam::$map 2020-11-03 10:29:37 +01:00
Guilhem Niot
dd8d3c00b6
Merge pull request #1735 from maxperrimond/fos-query-param-map
Fix Fos rest query param with map
2020-11-03 10:10:02 +01:00
Guilhem Niot
1279c82d43
Merge pull request #1737 from magnetik/override-init-swagger
Allow to pass options to the constructor of SwaggerUIBundle
2020-11-03 10:04:54 +01:00
Baptiste Lafontaine
cc5bc47a0b Add documentation 2020-11-02 11:21:34 +01:00
Guilhem Niot
e1700ba4b5 Fix the detection of references in the RouteMetadataDescriber 2020-11-01 11:41:49 +01:00
Guilhem Niot
8c0dcf5605
Improve error about property type 2020-11-01 11:32:13 +01:00
Baptiste Lafontaine
cbab00939f Allow to pass options to the constructor of SwaggerUIBundle 2020-10-23 15:04:00 +02:00
Maxime Perrimond
fafd243f55 Fix Fos rest query param with map 2020-10-22 11:30:34 +02:00
Guilhem Niot
00e4b53802
Merge pull request #1727 from lucassabreu/add-utf8-charset
(feat): add utf-8 charset to response
2020-10-04 09:48:59 +02:00
Lucas dos Santos Abreu
b022f6b219 (feat): add utf-8 charset to response
`swagger-ui-bundle` is very sensible to encoding changes because of the
RegExp performed.

ensuring UTF-8 on the response prevents end-user config to break it.

the annotations already needs to be UTF-8 compatible to generate the
JSON, so it should not break users applications.
2020-10-02 14:04:16 -03:00
Guilhem Niot
2f8416618d Merge branch '3.x' 2020-09-29 12:31:37 +02:00