src/Graviton/SwaggerBundle/Service/Swagger.php
protected function getBasicPathStructure($isCollectionRequest, $entityName, $entityClassName, $idType)
    {
        $thisPath = array(
            'consumes' => array('application/json'),
            'produces' => array('application/json')
        );

        // collection return or not?
        if (!$isCollectionRequest) {
            // add object response
            $thisPath['responses'] = array(
                200 => array(
                    'description' => $entityName . ' response',
                    'schema' => array('$ref' => '#/definitions/' . $entityClassName)
                ),
                404 => array(
                    'description' => 'Resource not found'
                )
            );

            // add id param
            $thisPath['parameters'][] = array(
                'name' => 'id',
                'in' => 'path',
                'description' => 'ID of ' . $entityName . ' item to fetch/update',
                'required' => true,
                'type' => $idType
            );
        } else {
            // add array response
            $thisPath['responses'][200] = array(
                'description' => $entityName . ' response',
                'schema' => array(
                    'type' => 'array',
                    'items' => array('$ref' => '#/definitions/' . $entityClassName)
                )
            );
        }

        return $thisPath;
    }
protected function getBasicPathStructure($isCollectionRequest, $entityName, $entityClassName, $idType)
    {
        $thisPath = array(
            'consumes' => array('application/json'),
            'produces' => array('application/json')
        );

        // collection return or not?
        if (!$isCollectionRequest) {
            // add object response
            $thisPath['responses'] = array(
                200 => array(
                    'description' => $entityName . ' response',
                    'schema' => array('$ref' => '#/definitions/' . $entityClassName)
                ),
                404 => array(
                    'description' => 'Resource not found'
                )
            );

            // add id param
            $thisPath['parameters'][] = array(
                'name' => 'id',
                'in' => 'path',
                'description' => 'ID of ' . $entityName . ' item to fetch/update',
                'required' => true,
                'type' => $idType
            );
        } else {
            // add array response
            $thisPath['responses'][200] = array(
                'description' => $entityName . ' response',
                'schema' => array(
                    'type' => 'array',
                    'items' => array('$ref' => '#/definitions/' . $entityClassName)
                )
            );
        }

        return $thisPath;
    }
protected function getBasicPathStructure ( $ isCollectionRequest , $ entityName , $ entityClassName , $ idType ) { $ thisPath = array ( 'consumes' => array ( 'application/json' ) , 'produces' => array ( 'application/json' ) ) ; // collection return or not? if ( ! $ isCollectionRequest ) { // add object response $ thisPath [ 'responses' ] = array ( 200 => array ( 'description' => $ entityName . ' response' , 'schema' => array ( '$ref' => '#/definitions/' . $ entityClassName ) ) , 404 => array ( 'description' => 'Resource not found' ) ) ; // add id param $ thisPath [ 'parameters' ] [ ] = array ( 'name' => 'id' , 'in' => 'path' , 'description' => 'ID of ' . $ entityName . ' item to fetch/update' , 'required' => true , 'type' => $ idType ) ; } else { // add array response $ thisPath [ 'responses' ] [ 200 ] = array ( 'description' => $ entityName . ' response' , 'schema' => array ( 'type' => 'array' , 'items' => array ( '$ref' => '#/definitions/' . $ entityClassName ) ) ) ; } return $ thisPath ; }
Return the basic structure of a path element

@param bool   $isCollectionRequest if collection request
@param string $entityName          entity name
@param string $entityClassName     class name
@param string $idType              type of id field

@return array Path spec
Return the basic structure of a path element