public function parseSchema($openApiSpec)
    {
        $openApiSpecContents = file_get_contents($openApiSpec);
        $schemaClass         = self::OPEN_API_MODEL;
        $schema              = null;
        $jsonException       = null;
        $yamlException       = null;

        try {
            return $this->serializer->deserialize(
                $openApiSpecContents,
                $schemaClass,
                self::CONTENT_TYPE_JSON,
                [
                    'document-origin' => $openApiSpec
                ]
            );
        } catch (\Exception $exception) {
            $jsonException = $exception;
        }

        $content = Yaml::parse($openApiSpecContents, Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP | Yaml::PARSE_DATETIME | Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
        $openApiSpecContents = json_encode($content);

        return $this->serializer->deserialize(
            $openApiSpecContents,
            $schemaClass,
            self::CONTENT_TYPE_JSON,
            [
                'document-origin' => $openApiSpec
            ]
        );
    }
public function parseSchema($openApiSpec)
    {
        $openApiSpecContents = file_get_contents($openApiSpec);
        $schemaClass         = self::OPEN_API_MODEL;
        $schema              = null;
        $jsonException       = null;
        $yamlException       = null;

        try {
            return $this->serializer->deserialize(
                $openApiSpecContents,
                $schemaClass,
                self::CONTENT_TYPE_JSON,
                [
                    'document-origin' => $openApiSpec
                ]
            );
        } catch (\Exception $exception) {
            $jsonException = $exception;
        }

        $content = Yaml::parse($openApiSpecContents, Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP | Yaml::PARSE_DATETIME | Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
        $openApiSpecContents = json_encode($content);

        return $this->serializer->deserialize(
            $openApiSpecContents,
            $schemaClass,
            self::CONTENT_TYPE_JSON,
            [
                'document-origin' => $openApiSpec
            ]
        );
    }
public function parseSchema ( $ openApiSpec ) { $ openApiSpecContents = file_get_contents ( $ openApiSpec ) ; $ schemaClass = self :: OPEN_API_MODEL ; $ schema = null ; $ jsonException = null ; $ yamlException = null ; try { return $ this -> serializer -> deserialize ( $ openApiSpecContents , $ schemaClass , self :: CONTENT_TYPE_JSON , [ 'document-origin' => $ openApiSpec ] ) ; } catch ( \ Exception $ exception ) { $ jsonException = $ exception ; } $ content = Yaml :: parse ( $ openApiSpecContents , Yaml :: PARSE_OBJECT | Yaml :: PARSE_OBJECT_FOR_MAP | Yaml :: PARSE_DATETIME | Yaml :: PARSE_EXCEPTION_ON_INVALID_TYPE ) ; $ openApiSpecContents = json_encode ( $ content ) ; return $ this -> serializer -> deserialize ( $ openApiSpecContents , $ schemaClass , self :: CONTENT_TYPE_JSON , [ 'document-origin' => $ openApiSpec ] ) ; }
Parse an file into a OpenAPI Schema model

@param string $openApiSpec

@return OpenApi

@throws ParseFailureException
Parse an file into a OpenAPI Schema model