Remove dunglasapibundle support

This commit is contained in:
Ilyas Salikhov 2024-10-01 17:26:49 +03:00
parent e97eba7c1b
commit 636eeb7cae
16 changed files with 42 additions and 3554 deletions

View File

@ -1,41 +0,0 @@
dist: trusty
language: php
sudo: false
cache:
directories:
- $HOME/.composer/cache
matrix:
include:
- php: 5.4
env: SYMFONY_VERSION=2.3.*
- php: 5.5
env: SYMFONY_DEPRECATIONS_HELPER=weak
- php: 5.6
env: SYMFONY_VERSION=2.7.* COVERAGE=true
- php: 5.6
env: SYMFONY_VERSION=2.8.*
- php: 5.6
env: SYMFONY_VERSION=3.0.*
- php: 7.0
env: SYMFONY_DEPRECATIONS_HELPER=weak
- php: hhvm
env: SYMFONY_DEPRECATIONS_HELPER=weak
fast_finish: true
before_install:
- if [ "$COVERAGE" != "true" ] && [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then phpenv config-rm xdebug.ini; fi
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
before_script:
- composer self-update
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
- if [ "$SYMFONY_VERSION" != "3.0.*" ] && [ "$SYMFONY_VERSION" != "2.8.*" ] && [ "$SYMFONY_VERSION" != "2.7.*" ]; then sed -i "/dunglas\/api-bundle/d;/symfony\/serializer/d" composer.json; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- composer update $COMPOSER_FLAGS
script:
- if [ "$COVERAGE" == "true" ]; then phpunit --coverage-text; else phpunit; fi

View File

@ -32,10 +32,5 @@ class LoadExtractorParsersPass implements CompilerPassInterface
if ($container->hasDefinition('jms_serializer.serializer')) {
$loader->load('services.jms.xml');
}
// DunglasJsonLdApiBundle may or may not be installed, if it is, load that config as well
if ($container->hasDefinition('api.resource_collection')) {
$loader->load('services.dunglas_api.xml');
}
}
}

View File

@ -1,12 +1,6 @@
NelmioApiDocBundle
==================
[![Build
Status](https://secure.travis-ci.org/nelmio/NelmioApiDocBundle.png?branch=master)](http://travis-ci.org/nelmio/NelmioApiDocBundle)
[![Total Downloads](https://poser.pugx.org/nelmio/api-doc-bundle/downloads)](https://packagist.org/packages/nelmio/api-doc-bundle)
[![Latest Stable
Version](https://poser.pugx.org/nelmio/api-doc-bundle/v/stable)](https://packagist.org/packages/nelmio/api-doc-bundle)
The **NelmioApiDocBundle** bundle allows you to generate a decent documentation
for your APIs.

View File

@ -1,23 +0,0 @@
DunglasApiBundle Support
========================
This bundle recognizes and documents resources exposed with
`DunglasApiBundle`_.
Install NelmioApiDocBundle and the documentation will be automatically
available. To enable the sandbox, use the following configuration:
.. code-block:: yaml
# app/config/config.yml
nelmio_api_doc:
sandbox:
accept_type: "application/json"
body_format:
formats: [ "json" ]
default_format: "json"
request_format:
formats:
json: "application/json"
.. _`DunglasApiBundle`: https://github.com/dunglas/DunglasApiBundle

View File

@ -94,7 +94,6 @@ setup your API documentation:
multiple-api-doc
other-bundle-annotations
swagger-support
dunglasapibundle
sandbox
commands
configuration-in-depth

View File

@ -1,44 +0,0 @@
<?php
/*
* This file is part of the NelmioApiDocBundle.
*
* (c) Nelmio <hello@nelm.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Tests\Extractor\AnnotationsProvider;
use Nelmio\ApiDocBundle\Tests\WebTestCase;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class DunglasApiProviderTest extends WebTestCase
{
protected function setUp(): void
{
if (!class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
$this->markTestSkipped(
'DunglasApiBundle is not available.'
);
}
}
public function testGetAnnotations(): void
{
$container = $this->getContainer();
$provider = $container->get('nelmio_api_doc.annotations_provider.dunglas_api_annotation_provider');
$annotations = $provider->getAnnotations();
$this->assertCount(5, $annotations);
foreach ($annotations as $annotation) {
$this->assertInstanceOf('Nelmio\ApiDocBundle\Annotation\ApiDoc', $annotation);
$this->assertInstanceOf('Symfony\Component\Routing\Route', $annotation->getRoute());
$this->assertTrue('' != $annotation->getDescription());
}
}
}

View File

@ -17,21 +17,10 @@ use Nelmio\ApiDocBundle\Tests\WebTestCase;
class ApiDocExtractorTest extends WebTestCase
{
public const NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE = 5;
private static $ROUTES_QUANTITY_DEFAULT = 28; // Routes in the default view
private static $ROUTES_QUANTITY_PREMIUM = 5; // Routes in the premium view
private static $ROUTES_QUANTITY_TEST = 2; // Routes in the test view
public static function setUpBeforeClass(): void
{
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
self::$ROUTES_QUANTITY_DEFAULT += self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE;
self::$ROUTES_QUANTITY_PREMIUM += self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE;
self::$ROUTES_QUANTITY_TEST += self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE;
}
}
public function testAll(): void
{
$container = $this->getContainer();
@ -40,11 +29,6 @@ class ApiDocExtractorTest extends WebTestCase
$data = $extractor->all();
restore_error_handler();
$httpsKey = 21;
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
$httpsKey += self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE;
}
$this->assertTrue(is_array($data));
$this->assertCount(self::$ROUTES_QUANTITY_DEFAULT, $data);
@ -61,39 +45,6 @@ class ApiDocExtractorTest extends WebTestCase
$this->assertInstanceOf('Symfony\Component\Routing\Route', $d['annotation']->getRoute());
$this->assertNotNull($d['resource']);
}
// $a1 = $data[7]['annotation'];
// $array1 = $a1->toArray();
// $this->assertTrue($a1->isResource());
// $this->assertEquals('index action', $a1->getDescription());
// $this->assertTrue(is_array($array1['filters']));
// $this->assertNull($a1->getInput());
//
// $a2 = $data[8]['annotation'];
// $array2 = $a2->toArray();
// $this->assertFalse($a2->isResource());
// $this->assertEquals('create test', $a2->getDescription());
// $this->assertFalse(isset($array2['filters']));
// $this->assertEquals('Nelmio\ApiDocBundle\Tests\Fixtures\Form\TestType', $a2->getInput());
//
// $a2 = $data[9]['annotation'];
// $array2 = $a2->toArray();
// $this->assertFalse($a2->isResource());
// $this->assertEquals('create test', $a2->getDescription());
// $this->assertFalse(isset($array2['filters']));
// $this->assertEquals('Nelmio\ApiDocBundle\Tests\Fixtures\Form\TestType', $a2->getInput());
//
// $a3 = $data[$httpsKey]['annotation'];
// $this->assertTrue($a3->getHttps());
//
// $a4 = $data[11]['annotation'];
// $this->assertTrue($a4->isResource());
// $this->assertEquals('TestResource', $a4->getResource());
//
// $a5 = $data[$httpsKey - 1]['annotation'];
// $a5requirements = $a5->getRequirements();
// $this->assertEquals('api.test.dev', $a5->getHost());
// $this->assertEquals('test.dev|test.com', $a5requirements['domain']['requirement']);
}
public function testRouteVersionChecking(): void
@ -298,12 +249,9 @@ class ApiDocExtractorTest extends WebTestCase
$this->assertFalse($parameters['required_field']['required']);
}
public static function dataProviderForViews()
public static function dataProviderForViews(): array
{
$offset = 0;
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
$offset = self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE;
}
return [
['default', self::$ROUTES_QUANTITY_DEFAULT + $offset],

View File

@ -11,9 +11,6 @@
namespace Nelmio\ApiDocBundle\Tests\Fixtures\Model;
/**
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class Popo
{
/**

View File

@ -29,11 +29,6 @@ class AppKernel extends Kernel
new \Nelmio\ApiDocBundle\Tests\Fixtures\NelmioApiDocTestBundle(),
];
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
$bundles[] = new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle();
$bundles[] = new \Dunglas\ApiBundle\DunglasApiBundle();
}
return $bundles;
}
@ -56,10 +51,6 @@ class AppKernel extends Kernel
{
$loader->load(__DIR__ . '/config/' . $this->environment . '.yml');
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
$loader->load(__DIR__ . '/config/dunglas_api.yml');
}
// If symfony/framework-bundle > 3.0
if (!class_exists('Symfony\Bundle\FrameworkBundle\Command\RouterApacheDumperCommand')) {
$loader->load(__DIR__ . '/config/twig_assets.yml');

View File

@ -1,22 +0,0 @@
doctrine:
dbal:
driver: "pdo_sqlite"
path: "%kernel.cache_dir%/db.sqlite"
charset: "UTF8"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
framework:
router: { resource: "%kernel.project_dir%/config/dunglas_api_routing.yml" }
dunglas_api:
title: API
description: Test API
services:
dunglas_api.popo:
parent: api.resource
arguments: [ Nelmio\ApiDocBundle\Tests\Fixtures\Model\Popo ]
tags: [ { name: api.resource } ]

View File

@ -1,6 +0,0 @@
main:
resource: "routing.yml"
dunglas_api:
resource: "."
type: "api"

View File

@ -26,7 +26,7 @@ class MarkdownFormatterTest extends WebTestCase
restore_error_handler();
$result = $container->get('nelmio_api_doc.formatter.markdown_formatter')->format($data);
$suffix = class_exists('Dunglas\ApiBundle\DunglasApiBundle') ? '' : '_1';
$suffix = '_1';
$expected = file_get_contents(__DIR__ . '/testFormat-result' . $suffix . '.markdown');
if (LegacyFormHelper::isLegacy()) {
$expected = str_replace('DependencyType', 'dependency_type', $expected);

View File

@ -25,7 +25,7 @@ class SimpleFormatterTest extends WebTestCase
restore_error_handler();
$result = $container->get('nelmio_api_doc.formatter.simple_formatter')->format($data);
$suffix = class_exists('Dunglas\ApiBundle\DunglasApiBundle') ? '' : '_1';
$suffix = '_1';
$expected = require __DIR__ . '/testFormat-result' . $suffix . '.php';
$this->assertEquals($expected, $result, 'file ' . __DIR__ . '/testFormat-result' . $suffix . '.php');

View File

@ -41,73 +41,6 @@ class SwaggerFormatterTest extends WebTestCase
/** @var $formatter SwaggerFormatter */
$actual = $this->formatter->format($data, null);
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
$expected = [
'swaggerVersion' => '1.2',
'apis' => [
0 => [
'path' => '/other-resources',
'description' => 'Operations on another resource.',
],
1 => [
'path' => '/resources',
'description' => 'Operations on resource.',
],
2 => [
'path' => '/tests',
'description' => null,
],
3 => [
'path' => '/tests',
'description' => null,
],
4 => [
'path' => '/tests2',
'description' => null,
],
5 => [
'path' => '/TestResource',
'description' => null,
],
6 => [
'path' => '/others',
'description' => 'Popo',
],
7 => [
'path' => '/others',
'description' => 'Popo',
],
8 => [
'path' => '/others',
'description' => 'Popo',
],
9 => [
'path' => '/others',
'description' => 'Popo',
],
10 => [
'path' => '/others',
'description' => 'Popo',
],
],
'apiVersion' => '3.14',
'info' => [
'title' => 'Nelmio Swagger',
'description' => 'Testing Swagger integration.',
'TermsOfServiceUrl' => 'https://github.com',
'contact' => 'user@domain.tld',
'license' => 'MIT',
'licenseUrl' => 'http://opensource.org/licenses/MIT',
],
'authorizations' => [
'apiKey' => [
'type' => 'apiKey',
'passAs' => 'header',
'keyname' => 'access_token',
],
],
];
} else {
$expected = [
'swaggerVersion' => '1.2',
'apiVersion' => '3.14',
@ -153,7 +86,6 @@ class SwaggerFormatterTest extends WebTestCase
],
],
];
}
$this->assertEquals($expected, $actual);
}

View File

@ -1,973 +0,0 @@
# Popo #
### `GET` /popos ###
_Retrieves the collection of Popo resources._
#### Response ####
foo:
* type: string
### `POST` /popos ###
_Creates a Popo resource._
#### Parameters ####
foo:
* type: string
* required: false
#### Response ####
foo:
* type: string
### `DELETE` /popos/{id} ###
_Deletes the Popo resource._
#### Requirements ####
**id**
- Type: string
### `GET` /popos/{id} ###
_Retrieves Popo resource._
#### Requirements ####
**id**
- Type: int
#### Response ####
foo:
* type: string
### `PUT` /popos/{id} ###
_Replaces the Popo resource._
#### Requirements ####
**id**
- Type: string
#### Parameters ####
foo:
* type: string
* required: false
#### Response ####
foo:
* type: string
## /api/other-resources ##
### `GET` /api/other-resources.{_format} ###
_List another resource._
#### Requirements ####
**_format**
- Requirement: json|xml|html
#### Response ####
[]:
* type: array of objects (JmsTest)
[][foo]:
* type: string
[][bar]:
* type: DateTime
[][number]:
* type: double
[][arr]:
* type: array
[][nested]:
* type: object (JmsNested)
[][nested][foo]:
* type: DateTime
[][nested][bar]:
* type: string
[][nested][baz][]:
* type: array of integers
* description: Epic description.
With multiple lines.
[][nested][circular]:
* type: object (JmsNested)
[][nested][parent]:
* type: object (JmsTest)
[][nested][parent][foo]:
* type: string
[][nested][parent][bar]:
* type: DateTime
[][nested][parent][number]:
* type: double
[][nested][parent][arr]:
* type: array
[][nested][parent][nested]:
* type: object (JmsNested)
[][nested][parent][nested_array][]:
* type: array of objects (JmsNested)
[][nested][since]:
* type: string
* versions: >=0.2
[][nested][until]:
* type: string
* versions: <=0.3
[][nested][since_and_until]:
* type: string
* versions: >=0.4,<=0.5
[][nested_array][]:
* type: array of objects (JmsNested)
### `PUT|PATCH` /api/other-resources/{id}.{_format} ###
_Update a resource bu ID._
#### Requirements ####
**_format**
- Requirement: json|xml|html
**id**
## /api/resources ##
### `GET` /api/resources.{_format} ###
_List resources._
#### Requirements ####
**_format**
- Requirement: json|xml|html
#### Response ####
tests[]:
* type: array of objects (Test)
tests[][a]:
* type: string
tests[][b]:
* type: DateTime
### `POST` /api/resources.{_format} ###
_Create a new resource._
#### Requirements ####
**_format**
- Requirement: json|xml|html
#### Parameters ####
a:
* type: string
* required: true
* description: Something that describes A.
b:
* type: float
* required: true
c:
* type: choice
* required: true
d:
* type: datetime
* required: true
e:
* type: date
* required: true
g:
* type: string
* required: true
#### Response ####
foo:
* type: DateTime
bar:
* type: string
baz[]:
* type: array of integers
* description: Epic description.
With multiple lines.
circular:
* type: object (JmsNested)
circular[foo]:
* type: DateTime
circular[bar]:
* type: string
circular[baz][]:
* type: array of integers
* description: Epic description.
With multiple lines.
circular[circular]:
* type: object (JmsNested)
circular[parent]:
* type: object (JmsTest)
circular[parent][foo]:
* type: string
circular[parent][bar]:
* type: DateTime
circular[parent][number]:
* type: double
circular[parent][arr]:
* type: array
circular[parent][nested]:
* type: object (JmsNested)
circular[parent][nested_array][]:
* type: array of objects (JmsNested)
circular[since]:
* type: string
* versions: >=0.2
circular[until]:
* type: string
* versions: <=0.3
circular[since_and_until]:
* type: string
* versions: >=0.4,<=0.5
parent:
* type: object (JmsTest)
parent[foo]:
* type: string
parent[bar]:
* type: DateTime
parent[number]:
* type: double
parent[arr]:
* type: array
parent[nested]:
* type: object (JmsNested)
parent[nested_array][]:
* type: array of objects (JmsNested)
since:
* type: string
* versions: >=0.2
until:
* type: string
* versions: <=0.3
since_and_until:
* type: string
* versions: >=0.4,<=0.5
### `DELETE` /api/resources/{id}.{_format} ###
_Delete a resource by ID._
#### Requirements ####
**_format**
- Requirement: json|xml|html
**id**
### `GET` /api/resources/{id}.{_format} ###
_Retrieve a resource by ID._
#### Requirements ####
**_format**
- Requirement: json|xml|html
**id**
## /tests ##
### `GET` /tests.{_format} ###
_index action_
#### Requirements ####
**_format**
#### Filters ####
a:
* DataType: integer
b:
* DataType: string
* Arbitrary: ["arg1","arg2"]
### `GET` /tests.{_format} ###
_index action_
#### Requirements ####
**_format**
#### Filters ####
a:
* DataType: integer
b:
* DataType: string
* Arbitrary: ["arg1","arg2"]
### `POST` /tests.{_format} ###
_create test_
#### Requirements ####
**_format**
#### Parameters ####
a:
* type: string
* required: true
* description: A nice description
b:
* type: string
* required: false
c:
* type: boolean
* required: true
d:
* type: string
* required: true
* default value: DefaultTest
### `POST` /tests.{_format} ###
_create test_
#### Requirements ####
**_format**
#### Parameters ####
a:
* type: string
* required: true
* description: A nice description
b:
* type: string
* required: false
c:
* type: boolean
* required: true
d:
* type: string
* required: true
* default value: DefaultTest
## /tests2 ##
### `POST` /tests2.{_format} ###
_post test 2_
#### Requirements ####
**_format**
## TestResource ##
### `ANY` /named-resource ###
### `POST` /another-post ###
_create another test_
#### Parameters ####
dependency_type:
* type: object (DependencyType)
* required: true
dependency_type[a]:
* type: string
* required: true
* description: A nice description
### `ANY` /any ###
_Action without HTTP verb_
### `ANY` /any/{foo} ###
_Action without HTTP verb_
#### Requirements ####
**foo**
### `ANY` /authenticated ###
### `POST` /jms-input-test ###
_Testing JMS_
#### Parameters ####
foo:
* type: string
* required: false
number:
* type: double
* required: false
arr:
* type: array
* required: false
nested:
* type: object (JmsNested)
* required: false
nested[bar]:
* type: string
* required: false
* default value: baz
nested[baz][]:
* type: array of integers
* required: false
* description: Epic description.
With multiple lines.
nested[circular]:
* type: object (JmsNested)
* required: false
nested[parent]:
* type: object (JmsTest)
* required: false
nested[parent][foo]:
* type: string
* required: false
nested[parent][number]:
* type: double
* required: false
nested[parent][arr]:
* type: array
* required: false
nested[parent][nested]:
* type: object (JmsNested)
* required: false
nested[parent][nested_array][]:
* type: array of objects (JmsNested)
* required: false
nested[since]:
* type: string
* required: false
nested[until]:
* type: string
* required: false
nested[since_and_until]:
* type: string
* required: false
nested_array[]:
* type: array of objects (JmsNested)
* required: false
### `GET` /jms-return-test ###
_Testing return_
#### Response ####
dependency_type:
* type: object (DependencyType)
dependency_type[a]:
* type: string
* description: A nice description
### `ANY` /my-commented/{id}/{page}/{paramType}/{param} ###
_This method is useful to test if the getDocComment works._
This method is useful to test if the getDocComment works.
And, it supports multilines until the first '@' char.
#### Requirements ####
**id**
- Type: int
- Description: A nice comment
**page**
- Type: int
**paramType**
- Type: int
- Description: The param type
**param**
- Type: int
- Description: The param id
### `ANY` /return-nested-output ###
#### Response ####
foo:
* type: string
bar:
* type: DateTime
number:
* type: double
arr:
* type: array
nested:
* type: object (JmsNested)
nested[foo]:
* type: DateTime
nested[bar]:
* type: string
nested[baz][]:
* type: array of integers
* description: Epic description.
With multiple lines.
nested[circular]:
* type: object (JmsNested)
nested[parent]:
* type: object (JmsTest)
nested[parent][foo]:
* type: string
nested[parent][bar]:
* type: DateTime
nested[parent][number]:
* type: double
nested[parent][arr]:
* type: array
nested[parent][nested]:
* type: object (JmsNested)
nested[parent][nested_array][]:
* type: array of objects (JmsNested)
nested[since]:
* type: string
* versions: >=0.2
nested[until]:
* type: string
* versions: <=0.3
nested[since_and_until]:
* type: string
* versions: >=0.4,<=0.5
nested_array[]:
* type: array of objects (JmsNested)
### `GET` /route_with_host.{_format} ###
_Route with host placeholder_
#### Requirements ####
**domain**
- Requirement: test.dev|test.com
**_format**
### `ANY` /secure-route ###
### `ANY` /yet-another/{id} ###
#### Requirements ####
**id**
- Requirement: \d+
### `GET` /z-action-with-deprecated-indicator ###
### This method is deprecated ###
### `ANY` /z-return-jms-and-validator-output ###
#### Response ####
bar:
* type: DateTime
objects[]:
* type: array of objects (Test)
objects[][a]:
* type: string
objects[][b]:
* type: DateTime
number:
* type: DateTime
related:
* type: object (Test)
related[a]:
* type: string
related[b]:
* type: DateTime
### `ANY` /z-return-selected-parsers-input ###
#### Parameters ####
a:
* type: string
* required: true
* description: A nice description
b:
* type: string
* required: false
c:
* type: boolean
* required: true
d:
* type: string
* required: true
* default value: DefaultTest
### `ANY` /z-return-selected-parsers-output ###
#### Response ####
bar:
* type: DateTime
objects[]:
* type: array of objects (Test)
objects[][a]:
* type: string
objects[][b]:
* type: DateTime
number:
* type: DateTime
related:
* type: object (Test)
related[a]:
* type: string
related[b]:
* type: DateTime
### `POST` /zcached ###
### `POST` /zsecured ###
### `GET` /zz-tests-route-version.{_format} ###
#### Requirements ####
**_format**

File diff suppressed because it is too large Load Diff