Covivo/mobicoop

View on GitHub
api/config/packages/api_platform.yaml

Summary

Maintainability
Test Coverage
api_platform:

    # The title of the API.
    title: 'Mobicoop Platform API'

    # The description of the API.
    description: "
    Mobicoop Platform API is an Open Source carpooling platform.


    It's operated by many public authorities and private organizations.

    ## Authentification
    
    This API use **JWT Token authentification**. To get the security token you must send a **POST** request on one of this two routes depending of your own context :
    
    - /login

    - /auth
    
    
    The API response contains a **token**. Every request will need this token in its header as an **Authorization** field with a **Bearer** prefix such as :
    

    ```
    'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImN0eSI...'
    ```

    
    The body of this request must be a JSON object based on this definition :


    ```
    {
        \"username\":\"API_USERNAME\",
        \"password\":\"API_PASSWORD\"        
    }
    ```
    
    ## Specific domains
    
    This document contains all endpoints of the API.


    - If you're only looking for the **[RDEX](https://www.feduco.org/articles/actus/rdex/) protocol routes** <a href='#operations-tag-RDEX'>get to them</a>

    - If you're only looking for the **[RDEX+](https://rdex.fabmob.io/) protocol routes** <a href='#operations-tag-RDEX\\+'>get to them</a>

    - If you're only looking for the **Interoperability routes** <a href='#operations-tag-Interoperability'>jump right to them</a>

    
    **License** : [GNU Affero AGPL-v3](https://www.gnu.org/licenses/agpl.html)
    "

    # The version of the API.
    version: 'AGPL-v3'

    collection:
        pagination:
            client_items_per_page: true
            items_per_page_parameter_name: perPage

    # we disable the original swagger to change the path of the documentation
    enable_swagger_ui: true

    # enable token bearer
    swagger:
        api_keys:
             apiKey:
                name: Authorization
                type: header

    mapping:
        paths: [
            '%kernel.project_dir%/src/Entity',
            '%kernel.project_dir%/src/Action/Entity',
            '%kernel.project_dir%/src/App/Entity',
            '%kernel.project_dir%/src/Article/Entity',
            '%kernel.project_dir%/src/Auth/Entity',
            '%kernel.project_dir%/src/Carpool/Entity',
            '%kernel.project_dir%/src/Communication/Entity',
            '%kernel.project_dir%/src/Community/Entity',
            '%kernel.project_dir%/src/Editorial/Entity',
            '%kernel.project_dir%/src/Event/Entity',
            '%kernel.project_dir%/src/ExternalJourney/Entity',
            '%kernel.project_dir%/src/Gamification/Entity',
            '%kernel.project_dir%/src/Gratuity/Entity',
            '%kernel.project_dir%/src/Geography/Entity',
            '%kernel.project_dir%/src/I18n/Entity',
            '%kernel.project_dir%/src/Incentive/Entity',
            '%kernel.project_dir%/src/Image/Entity',
            '%kernel.project_dir%/src/Import/Entity',
            '%kernel.project_dir%/src/Journey/Entity',
            '%kernel.project_dir%/src/MassCommunication/Entity',
            '%kernel.project_dir%/src/Match/Entity',
            '%kernel.project_dir%/src/Payment/Entity',
            '%kernel.project_dir%/src/Price/Entity',
            '%kernel.project_dir%/src/PublicTransport/Entity',
            '%kernel.project_dir%/src/Rdex/Entity',
            '%kernel.project_dir%/src/RdexPlus/Entity',
            '%kernel.project_dir%/src/RelayPoint/Entity',
            '%kernel.project_dir%/src/Scammer/Entity',
            '%kernel.project_dir%/src/Solidary/Entity',
            '%kernel.project_dir%/src/Stats/Entity',
            '%kernel.project_dir%/src/Travel/Entity',
            '%kernel.project_dir%/src/User/Entity',
            '%kernel.project_dir%/src/Utility/Entity']
            
    resource_class_directories:
        - '%kernel.project_dir%/src/Entity'
        - '%kernel.project_dir%/src/Action/Entity'
        - '%kernel.project_dir%/src/App/Entity'
        - '%kernel.project_dir%/src/Auth/Entity'
        - '%kernel.project_dir%/src/Article/Entity'
        - '%kernel.project_dir%/src/Article/Ressource'
        - '%kernel.project_dir%/src/Carpool/Entity'
        - '%kernel.project_dir%/src/Carpool/Ressource'
        - '%kernel.project_dir%/src/Communication/Entity'
        - '%kernel.project_dir%/src/Community/Entity'
        - '%kernel.project_dir%/src/Community/Resource'
        - '%kernel.project_dir%/src/DataProvider/Ressource'
        - '%kernel.project_dir%/src/Editorial/Entity'
        - '%kernel.project_dir%/src/ExternalJourney/Entity'
        - '%kernel.project_dir%/src/ExternalJourney/Ressource'
        - '%kernel.project_dir%/src/Event/Entity'
        - '%kernel.project_dir%/src/Gamification/Entity'
        - '%kernel.project_dir%/src/Gamification/Resource'
        - '%kernel.project_dir%/src/Gratuity/Entity'
        - '%kernel.project_dir%/src/Gratuity/Resource'
        - '%kernel.project_dir%/src/Geography/Entity'
        - '%kernel.project_dir%/src/Geography/Ressource'
        - '%kernel.project_dir%/src/I18n/Entity'
        - '%kernel.project_dir%/src/Incentive/Entity'
        - '%kernel.project_dir%/src/Incentive/Resource'
        - '%kernel.project_dir%/src/Image/Entity'
        - '%kernel.project_dir%/src/Import/Entity'
        - '%kernel.project_dir%/src/Import/Ressource'
        - '%kernel.project_dir%/src/Import/Admin/Resource'
        - '%kernel.project_dir%/src/Journey/Entity'
        - '%kernel.project_dir%/src/MassCommunication/Entity'
        - '%kernel.project_dir%/src/MassCommunication/Ressource'
        - '%kernel.project_dir%/src/Match/Entity'
        - '%kernel.project_dir%/src/Monitor/Interfaces'
        - '%kernel.project_dir%/src/Payment/Entity'
        - '%kernel.project_dir%/src/Payment/Ressource'
        - '%kernel.project_dir%/src/Price/Entity'
        - '%kernel.project_dir%/src/PublicTransport/Entity'
        - '%kernel.project_dir%/src/Rdex/Entity'
        - '%kernel.project_dir%/src/RdexPlus/Resource'
        - '%kernel.project_dir%/src/RelayPoint/Entity'
        - '%kernel.project_dir%/src/Solidary/Entity'
        - '%kernel.project_dir%/src/Travel/Entity'
        - '%kernel.project_dir%/src/User/Entity'
        - '%kernel.project_dir%/src/User/Ressource'
        - '%kernel.project_dir%/src/User/Admin/Resource'
        - '%kernel.project_dir%/src/User/Interoperability/Ressource'
        - '%kernel.project_dir%/src/Utility/Entity'
        - '%kernel.project_dir%/src/Communication/Ressource'
        - '%kernel.project_dir%/src/RelayPoint/Resource'
        - '%kernel.project_dir%/src/Stats/Admin/Resource'
        - '%kernel.project_dir%/src/Scammer/Entity'
        - '%kernel.project_dir%/src/Validator/Phone/Resource'
        - '%kernel.project_dir%/src/Validator/DriverLicenceNumber/Resource'
        - '%kernel.project_dir%/src/CarpoolStandard/Entity'
        
    formats:
        jsonld:   ['application/ld+json']
        json:     ['application/json']
        xml:      ['application/xml', 'text/xml']
        html:     ['text/html']

    patch_formats:
        json:     ['application/merge-patch+json']
        jsonapi:  ['application/vnd.api+json']

    exception_to_status:
        # The 4 following handlers are registered by default, keep those lines to prevent unexpected side effects
        Symfony\Component\Serializer\Exception\ExceptionInterface: 400 # Use a raw status code (recommended)
        ApiPlatform\Core\Exception\InvalidArgumentException: 'HTTP_BAD_REQUEST' # Or a `Symfony\Component\HttpFoundation\Response`'s constant
        ApiPlatform\Core\Exception\FilterValidationException: 400
        Doctrine\ORM\OptimisticLockException: 409

        # Custom mapping
        #App\Exception\ProductNotFoundException: 404 # Here is the handler for our custom exception
        ClosedGeneratorException: 'HTTP_NOT_IMPLEMENTED'
        Doctrine\Common\Persistence\Mapping\MappingException: 'HTTP_SERVICE_UNAVAILABLE'
        Doctrine\ORM\ORMException: 'HTTP_SERVICE_UNAVAILABLE'
        Doctrine\ORM\Mapping\MappingException: 'HTTP_SERVICE_UNAVAILABLE'
        DOMException: 'HTTP_INTERNAL_SERVER_ERROR'
        ErrorException: 'HTTP_INTERNAL_SERVER_ERROR'
        ImagickDrawException: 'HTTP_INTERNAL_SERVER_ERROR'
        ImagickException: 'HTTP_INTERNAL_SERVER_ERROR'
        ImagickKernelException: 'HTTP_INTERNAL_SERVER_ERROR'
        ImagickPixelException: 'HTTP_INTERNAL_SERVER_ERROR'
        ImagickPixelIteratorException:  'HTTP_INTERNAL_SERVER_ERROR'
        IntlException: 'HTTP_BAD_REQUEST'
        LogicException: 'HTTP_INTERNAL_SERVER_ERROR'
        App\Image\Exception\ImageException: 'HTTP_INTERNAL_SERVER_ERROR'
        App\Image\Exception\OwnerNotFoundException: 'HTTP_NOT_FOUND'
        App\Match\Exception\MassException: 'HTTP_INTERNAL_SERVER_ERROR'
        App\Match\Exception\OwnerNotFoundException: 'HTTP_NOT_FOUND'
        BadFunctionCallException: 'HTTP_BAD_REQUEST'
        BadMethodCallException: 'HTTP_BAD_REQUEST'
        DomainException: 'HTTP_BAD_REQUEST'
        InvalidArgumentException: 'HTTP_BAD_REQUEST'
        Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: 'HTTP_BAD_REQUEST'
        Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: 'HTTP_BAD_REQUEST'
        LengthException: 'HTTP_INTERNAL_SERVER_ERROR'
        OutOfRangeException: 'HTTP_INTERNAL_SERVER_ERROR'
        PharException: 'HTTP_BAD_REQUEST'
        ReflectionException: 'HTTP_BAD_REQUEST'
        RuntimeException: 'HTTP_BAD_REQUEST'
        Http\Discovery\Exception\StrategyUnavailableException: 'HTTP_BAD_REQUEST'
        Http\Discovery\Exception\PuliUnavailableException: 'HTTP_BAD_REQUEST'
        MemcachedException: 'HTTP_BAD_REQUEST'
        mysqli_sql_exception: 'HTTP_BAD_REQUEST'
        OutOfBoundsException: 'HTTP_INSUFFICIENT_STORAGE'
        OverflowException: 'HTTP_INSUFFICIENT_STORAGE'
        PDOException: 'HTTP_BAD_REQUEST'
        RangeException: 'HTTP_INSUFFICIENT_STORAGE'
        Symfony\Component\DependencyInjection\Exception\RuntimeException: 'HTTP_INTERNAL_SERVER_ERROR'
        Symfony\Component\DependencyInjection\Exception\AutowiringFailedException: 'HTTP_INTERNAL_SERVER_ERROR'
        Symfony\Component\Security\Core\Exception\RuntimeException: 'HTTP_INTERNAL_SERVER_ERROR'
        Symfony\Component\Security\Core\Exception\AuthenticationException: 'HTTP_INTERNAL_SERVER_ERROR'
        UnderflowException: 'HTTP_BAD_REQUEST'
        UnexpectedValueException: 'HTTP_BAD_REQUEST'
        App\Carpool\Exception\AdException: 'HTTP_BAD_REQUEST'
        App\Carpool\Exception\AntiFraudException: 'HTTP_BAD_REQUEST'
        App\Carpool\Exception\DynamicException: 'HTTP_BAD_REQUEST'
        App\Carpool\Exception\ProofException: 'HTTP_BAD_REQUEST'
        App\CarpoolStandard\Exception\CarpoolStandardException: 'HTTP_BAD_REQUEST'
        App\User\Exception\UserNotFoundException: 'HTTP_BAD_REQUEST'
        App\User\Exception\UserAlreadyExistsException: 'HTTP_BAD_REQUEST'
        App\Community\Exception\CommunityException: 'HTTP_NOT_FOUND'
        App\Community\Exception\CommunityNotFoundException: 'HTTP_BAD_REQUEST'
        App\Event\Exception\EventNotFoundException: 'HTTP_BAD_REQUEST'
        App\Solidary\Exception\SolidaryException: 'HTTP_BAD_REQUEST'
        #SoapFault:
        #SodiumException: 'HTTP_BAD_REQUEST'