src/Graviton/ProxyBundle/Definition/Loader/DispersalStrategy/SwaggerStrategy.php
private function getServiceSchema($service)
    {
        $operation = $service->getOperation();
        $schema = new \stdClass();
        switch (strtolower($service->getMethod())) {
            case "post":
            case "put":
                try {
                    $parameters = $operation->getDocumentObjectProperty('parameters', Parameter\Body::class, true);
                } catch (MissingDocumentPropertyException $e) {
                    // request has no params
                    break;
                }
                foreach ($parameters as $parameter) {
                    /**
                     * there is no schema information available, if $action->parameters[0]->in != 'body'
                     *
                     * @link http://swagger.io/specification/#parameterObject
                     */
                    if ($parameter instanceof Parameter\Body && $parameter->getIn() === 'body') {
                        $ref = $parameter->getDocumentObjectProperty('schema', Reference::class)->getDocument();
                        $schema = $this->resolveSchema($ref);
                        break;
                    }
                }
                break;
            case "get":
                try {
                    $response = $operation->getResponses()->getHttpStatusCode(200);
                } catch (MissingDocumentPropertyException $e) {
                    // no response with status code 200 is defined
                    break;
                }
                $schema = $this->resolveSchema($response->getSchema()->getDocument());
                break;
        }

        return $schema;
    }
private function getServiceSchema($service)
    {
        $operation = $service->getOperation();
        $schema = new \stdClass();
        switch (strtolower($service->getMethod())) {
            case "post":
            case "put":
                try {
                    $parameters = $operation->getDocumentObjectProperty('parameters', Parameter\Body::class, true);
                } catch (MissingDocumentPropertyException $e) {
                    // request has no params
                    break;
                }
                foreach ($parameters as $parameter) {
                    /**
                     * there is no schema information available, if $action->parameters[0]->in != 'body'
                     *
                     * @link http://swagger.io/specification/#parameterObject
                     */
                    if ($parameter instanceof Parameter\Body && $parameter->getIn() === 'body') {
                        $ref = $parameter->getDocumentObjectProperty('schema', Reference::class)->getDocument();
                        $schema = $this->resolveSchema($ref);
                        break;
                    }
                }
                break;
            case "get":
                try {
                    $response = $operation->getResponses()->getHttpStatusCode(200);
                } catch (MissingDocumentPropertyException $e) {
                    // no response with status code 200 is defined
                    break;
                }
                $schema = $this->resolveSchema($response->getSchema()->getDocument());
                break;
        }

        return $schema;
    }
private function getServiceSchema ( $ service ) { $ operation = $ service -> getOperation ( ) ; $ schema = new \ stdClass ( ) ; switch ( strtolower ( $ service -> getMethod ( ) ) ) { case "post" : case "put" : try { $ parameters = $ operation -> getDocumentObjectProperty ( 'parameters' , Parameter \ Body :: class , true ) ; } catch ( MissingDocumentPropertyException $ e ) { // request has no params break ; } foreach ( $ parameters as $ parameter ) { /**
                     * there is no schema information available, if $action->parameters[0]->in != 'body'
                     *
                     * @link http://swagger.io/specification/#parameterObject
                     */ if ( $ parameter instanceof Parameter \ Body && $ parameter -> getIn ( ) === 'body' ) { $ ref = $ parameter -> getDocumentObjectProperty ( 'schema' , Reference :: class ) -> getDocument ( ) ; $ schema = $ this -> resolveSchema ( $ ref ) ; break ; } } break ; case "get" : try { $ response = $ operation -> getResponses ( ) -> getHttpStatusCode ( 200 ) ; } catch ( MissingDocumentPropertyException $ e ) { // no response with status code 200 is defined break ; } $ schema = $ this -> resolveSchema ( $ response -> getSchema ( ) -> getDocument ( ) ) ; break ; } return $ schema ; }
get the schema

@param OperationReference $service service endpoint

@return \stdClass
get the schema