160 Commits

Author SHA1 Message Date
Bez Hermoso
928a23e2c8 Updated regex pattern matching and added tests for parsing array<..> directives. 2014-09-04 10:47:57 -07:00
Bez Hermoso
f5c1b06807 Support for collections. 2014-09-04 10:47:57 -07:00
Bez Hermoso
06cfe9d48b Allow parsers to remove/replace root parameters. 2014-09-04 10:47:57 -07:00
Loick Piera
16b104edec Added support for Security annotation 2014-08-28 00:12:34 +02:00
Sergey Polischook
3e6a47818e Update PhpDocHandler.php
https://github.com/nelmio/NelmioApiDocBundle/issues/477
2014-08-16 01:59:39 +03:00
Bez Hermoso
cc0d445601 Added caching layer with the controllers and routing files as resources. 2014-07-31 00:43:59 -07:00
Bez Hermoso
a8221d4515 Post-parser support for response map models. 2014-07-29 10:25:06 -07:00
Bez Hermoso
9d3c0a8c29 Swagger support:
Unified data types [actualType and subType]
Updated tests.
JMS parsing fixes; updated {Validator,FormType}Parser, FOSRestHandler, and AbstractFormatter, and updated DataTypes enum.
Modified dataType checking.
Updated tests.
Updated DataTypes enum.
Quick fix and added doc comments.
CS fixes.
Refactored FormTypeParser to produce nested parameters. Updated tests accordingly.
Logical and CS fixes.
Sub-forms and more tests.
Logical and CS fixes.
Swagger support: created formatter.
Configuration and resourcePath logic update.
ApiDoc annotation update. Updated formatter and added tests.
Parameter formatting.
Added tests for SwaggerFormatter.
Added  option in annotation, and the corresponding logic for parsing the supplied values and processing them in the formatter.
Routing update.
Updated tests.
Removed unused dependency and updated doc comments.
Renamed 'responseModels' to 'responseMap'
Update the resource filtering and formatting of response messages.
Updated check for 200 response model.
Ignore data_class and always use form-type to avoid conflicts.
Fix: add 'type' even if '' is specified.
Refactored responseMap; added parsedResponseMap. Added tests and updated some.
Fix: add 'type' even if '' is specified.
Initial commit of command.
Finished logic for dumping files.
Updated doc comment; added license and added more meaningful class comment.
Array of models support.
2014-07-29 10:25:06 -07:00
Bez Hermoso
bb723bdb40 Added new tests for Swagger doc controllers. Also some CS fixes. 2014-07-29 10:25:06 -07:00
Bez Hermoso
6f85aed33c Swagger support:
Unified data types [actualType and subType]
Updated tests.
JMS parsing fixes; updated {Validator,FormType}Parser, FOSRestHandler, and AbstractFormatter, and updated DataTypes enum.
Modified dataType checking.
Updated tests.
Updated DataTypes enum.
Quick fix and added doc comments.
CS fixes.
Refactored FormTypeParser to produce nested parameters. Updated tests accordingly.
Logical and CS fixes.
Sub-forms and more tests.
Logical and CS fixes.
Swagger support: created formatter.
Configuration and resourcePath logic update.
ApiDoc annotation update. Updated formatter and added tests.
Parameter formatting.
Added tests for SwaggerFormatter.
Added  option in annotation, and the corresponding logic for parsing the supplied values and processing them in the formatter.
Routing update.
Updated tests.
Removed unused dependency and updated doc comments.
Renamed 'responseModels' to 'responseMap'
Update the resource filtering and formatting of response messages.
Updated check for 200 response model.
Ignore data_class and always use form-type to avoid conflicts.
Fix: add 'type' even if '' is specified.
Refactored responseMap; added parsedResponseMap. Added tests and updated some.
Fix: add 'type' even if '' is specified.
Initial commit of command.
Finished logic for dumping files.
Updated doc comment; added license and added more meaningful class comment.

Array of models support.
2014-07-29 10:25:05 -07:00
Bez Hermoso
882f658599 Added 'default' parameters in {JmsMetadata,Validator}Parser, and FOSRestHandler. 2014-06-27 10:19:28 +02:00
William Durand
0d1bde9f8a Merge pull request #352 from sroze/output-post-parser
Add PostParserInterface to JmsMetadataParser to get ValidatorParser found children parsed
2014-06-27 10:14:51 +02:00
Even André Fiskvik
b4e874e2dc Add support for nullable option in RequestParam 2014-06-25 10:19:30 +02:00
Bez Hermoso
14d1021c8b Unified data types [actualType and subType]
This is the result of https://github.com/nelmio/NelmioApiDocBundle/issues/410.

This PR aims to provide a uniform way of declaring data-types of parameters for
parsers and handlers to follow. In turn, this would allow formatters to
determine data-types in a cleaner and less volatile manner. (See use-case that
can be improved with this PR:
https://github.com/nelmio/NelmioApiDocBundle/blob/master/Formatter/AbstractFormatter.php#L103)

This is possible by the addition two properties to each property item in
`response`, and `parameters` fields in each API endpoint produced by the
`ApiDocExtractor`:

* `actualType` Contains a value from one of the `DataTypes` class constants.

* `subType` Can contain either `null`, or any other `DataTypes` class constant.
This is relevant when the `actualType` is a `DataTypes::COLLECTION`, wherein
`subType` would specify the type of the collection items. It is also relevant
when `actualType` is a `DataTypes::MODEL`, wherein `subType` would contain an
identifier of the model (the FQCN or anything the parser would wish to specify)

Examples:

```php

array(
    'id' => array(
        'dataType' => 'integer',
        'actualType' => DataTypes::INTEGER,
        'subType' => null,
    ),
    'profile' => array(
        'dataType' => 'object (Profile)',
        'actualType' => DataTypes::MODEL,
        'subType' => 'Foo\Entity\Profile',
        'children' => array(
            'name' => array(
                'dataType' => 'string',
                'actualType' => DataTypes::STRING,
                'subType' => null,
             ),
            'birthDate' => array(
                'dataType' => 'date',
                'actualType' => DataTypes::DATE,
                'subType' => null,
            ),
        )
    ),
    'languages' => array(
        'dataType' => 'array of strings',
        'actualType' => DataTypes::COLLECTION,
        'subType' => DataTypes::STRING,
    ),
    'roles' => array(
        'dataType' => 'array of choices',
        'actualType' => DataTypes::COLLECTION,
        'subType' => DataTypes::ENUM,
    ),
    'groups' => array(
        'dataType' => 'array of objects (Group)',
        'actualType' => DataTypes::COLLECTION,
        'subType' => 'Foo\Entity\Group',
    ),
    'profileRevisions' => array(
         'dataType' => 'array of objects (Profile)',
         'actualType' => DataTypes::COLLECTION,
         'subType' => 'Foo\Entity\Profile',
    ),
    'address' => array(
        'dataType' => 'object (a_type_a_custom_JMS_serializer_handler_handles)',
        'actualType' => DataTypes::MODEL,
        'subType' => 'a_type_a_custom_JMS_serializer_handler_handles',
    ),
);
```

When a formatter omits the `dataType` property or leaves it blank, it is
inferred within `ApiDocExtractor` before everything is passed to formatters.
2014-06-25 09:05:48 +02:00
William DURAND
b48650a9e0 Fix CS 2014-06-25 08:52:01 +02:00
Loick Piera
d0149c65ab fix #357 2014-05-16 22:04:24 +02:00
Samuel ROZE
3f66888f00 Add PostParserInterface to JmsMetadataParser to get ValidatorParser found children parsed. 2014-03-20 16:39:36 +01:00
William DURAND
667044863c Fix HTTPS detection
Fix #281
2014-01-20 14:18:02 +01:00
jdeveloper
dea78901a0 Added exclude_envs to ApiDoc annotation to exclude the documentation from the specified environments 2014-01-20 13:24:41 +01:00
Max Romanovsky
e4ec8e79f3 Fixed ApiDoc for controllers enhanced with JMS CG with Doctrine Common 2014-01-13 19:10:07 +03:00
William DURAND
6038fe842f Merge PR #299 from SimonSimCity/https-fixes
Fix #266
Close #283
Close #299
2013-12-28 18:55:06 +01:00
Simon Schick
912178dc88 Hide “_scheme” in the list of requirements per URL
+ disable sandbox if the scheme of the URL doesn’t match the scheme, the
documentation is opened in
2013-12-28 18:52:32 +01:00
William Durand
393dbaf6ed Merge pull request #282 from sroze/patch-1
Fix PHPDoc
2013-12-28 09:43:50 -08:00
William DURAND
627130637d Merge PR #288 from piotrantosik/feature/selectparsers 2013-12-28 18:42:51 +01:00
Piotr Antosik
3fdbfbed1c select used parsers 2013-12-28 18:41:59 +01:00
William DURAND
c3097c7439 cs 2013-12-11 01:59:59 +01:00
Marc J. Schmidt
ead8174192 Outsourced the parsing of the classic phpDoc into a extra handler.
This makes it possible to overwrite route-requirements/description through a own handler.
Otherwise it's impossible e.g. to overwrite a `@param string $page` annotation via a own handler.
2013-12-11 01:40:16 +01:00
Samuel ROZE
95e8c9d200 Fix typo
$route parameter of ApiDocExtractor::get is a string. Passing a Route object throw an error.
2013-11-21 15:05:45 +01:00
Samuel ROZE
184a364fa4 Merge output parameters 2013-11-16 17:29:23 +01:00
William DURAND
87328e27f5 Merge pull request #206 from dothiv/master
Show authorized roles in key icon tooltip
2013-11-14 11:17:06 +01:00
William DURAND
d7fd929379 Fix CS 2013-11-14 10:33:57 +01:00
Florent DUBOST
f16aa64cf0 more readable 2013-10-11 16:40:26 +02:00
Florent DUBOST
56fdd4e64c Adding possibilty to name resource 2013-10-11 15:44:31 +02:00
William Durand
c2d36d9ef0 Merge pull request #221 from kmfk/documentation-in-handler
Modify the `documentation` property inside annotation handlers
2013-09-12 01:51:49 -07:00
Eneko Illarramendi
fef656cd13 Not all "strict" params should be "Requirements" in the documentation
View https://github.com/nelmio/NelmioApiDocBundle/issues/229
2013-08-18 22:33:04 +02:00
Vincent CHALAMON
a1517543e8 Enable PHPDoc @link feature 2013-08-16 19:18:05 +02:00
keith kirk
f67dfb05db adds the ability to modify the documentation property inside custom extractor handlers 2013-07-25 13:47:54 -07:00
Josh Hall-Bachner
54a6ad566d Updated postParse logic to utilize an interface and to avoid unnecessary "supports" checks.
Expanded documentation on new classes and methods.
2013-07-02 21:57:09 -07:00
Josh Hall-Bachner
23f64b84f6 Fixed multi-level validation nesting.
Removed "class" parameters from results after processed.

Updated README.
2013-06-30 23:46:43 -07:00
Josh Hall-Bachner
5e1549a29d Built parse-merging into the ApiDocExtractor.
Wired up a "post-parse" pass to allow recursive parsing across multiple parsers.
2013-06-30 23:46:41 -07:00
Nils Wisiol
f764773c89 authenticationRoles can be set to appear in the tooltip of the key icon for API calls that require authentication. 2013-06-24 14:27:22 +02:00
Pierre-Yves LEBECQ
13efea8975 Added support for the jms version annotations in formatters 2013-05-12 14:54:01 +02:00
fieg
06271f824a added support for JMS Serializer GroupsExclusionStrategy 2013-05-12 14:29:36 +02:00
marapper
80b5162c83 Add @QueryParam default support 2013-05-06 10:04:13 +02:00
William Durand
5567f74692 Merge pull request #179 from lightglitch/fix-178
Fix parameter name boundary in regex
2013-05-06 01:00:51 -07:00
Jordi Boggiano
255d42830d Allow sf2.3, fix scope issue 2013-05-03 16:26:16 +02:00
Dave Keen
22508bf058 Update JmsSecurityExtraHandler.php
Having a JmsSecurity @PreAuthorize annotation should also count as setting a method as requiring authentication.
2013-04-29 12:10:42 +03:00
William Durand
08eebf0fa0 Merge pull request #177 from fvilpoix/annotation_handlers
Moving annotation extraction into tagged Handlers
2013-04-17 15:21:31 -07:00
fvilpoix
3e04cbfdf1 [ExtractorHandler] code cleaning 2013-04-17 14:24:45 +02:00
fvilpoix
7f79ddc065 [ExtractorHandler] cleaning code 2013-04-17 13:41:28 +02:00