Code Monkey home page Code Monkey logo

Comments (4)

cebe avatar cebe commented on August 21, 2024 2

Looks like this is fixed in dev-master, so it will be fixed by upgrading to 1.5.2, which I'll release today.

Thanks @marcelthole for checking.

from php-openapi.

marcelthole avatar marcelthole commented on August 21, 2024 1

i tried the example from @vdelau and can't reproduce the error with the latest dev-master version.

Repro:

  1. composer require cebe/php-openapi
  2. use 5G Apis yaml files (in my example from https://github.com/WhyBingo/5GC_APIs)
  3. use the provided snipped.php

-> I got the same error

Fix:

  1. composer require cebe/php-openapi:dev-master
    -> No errors anymore.

In the second example from @samizdam i have the same result.

  1. git clone https://github.com/FreeElephants/json-api-php-toolkit.git
  2. git checkout a9e501736a6da9fbc9a6c82cbfec60cd7d9442ad
  3. composer install
  4. vendor/bin/phpunit
    -> I got the same error

if i require "cebe/php-openapi": "dev-master" and run the phpunit tests i got no errors anymore.

In that case a new tag for cebe/php-openapi 1.5.2 should fix the errors in this example.

Each package maintainer that requires cebe/php-openapi could add the following in the composer.json

    "conflict": {
        "cebe/php-openapi": "1.5.0 || 1.5.1"
    }

from php-openapi.

vdelau avatar vdelau commented on August 21, 2024

I'm not sure I understand the original issue correctly, but I think I'm running into the same issue here. I'm trying to load a file from this repository (and branch): https://forge.etsi.org/rep/3GPP/5G_APIs/tree/REL-16

This is the simple snippet I'm using to do this, where ../specs/5G_APIs is a clone of the above repository:

<?php
require_once __DIR__ . '/../vendor/autoload.php';

use cebe\openapi\Reader;

$specfile = realpath(__DIR__ . '/../specs/5G_APIs/TS32291_Nchf_OfflineOnlyCharging.yaml');
$openapi = Reader::readFromYamlFile($specfile);

This fails with the following exception:

D:\Development\opt\php-8.0.0\php.exe D:\Development\PHP\5g_api\bin\generator.php
PHP Fatal error:  Uncaught cebe\openapi\json\NonexistentJsonPointerReferenceException: Failed to evaluate pointer '/components/schemas/Tai'. Array has no member Tai at path '/components/schemas'. in D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\json\JsonPointer.php:116
Stack trace:
#0 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\spec\Reference.php(199): cebe\openapi\json\JsonPointer->evaluate(Object(cebe\openapi\spec\OpenApi))
#1 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(391): cebe\openapi\spec\Reference->resolve(Object(cebe\openapi\ReferenceContext))
#2 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(397): cebe\openapi\SpecBaseObject->resolveReferences(NULL)
#3 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(394): cebe\openapi\SpecBaseObject->resolveReferences()
#4 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(394): cebe\openapi\SpecBaseObject->resolveReferences()
#5 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(384): cebe\openapi\SpecBaseObject->resolveReferences()
#6 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(397): cebe\openapi\SpecBaseObject->resolveReferences(NULL)
#7 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(384): cebe\openapi\SpecBaseObject->resolveReferences()
#8 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(397): cebe\openapi\SpecBaseObject->resolveReferences(NULL)
#9 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(384): cebe\openapi\SpecBaseObject->resolveReferences()
#10 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(397): cebe\openapi\SpecBaseObject->resolveReferences(NULL)
#11 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(387): cebe\openapi\SpecBaseObject->resolveReferences(NULL)
#12 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(387): cebe\openapi\SpecBaseObject->resolveReferences(NULL)
#13 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\spec\PathItem.php(194): cebe\openapi\SpecBaseObject->resolveReferences(NULL)
#14 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\spec\Paths.php(254): cebe\openapi\spec\PathItem->resolveReferences(NULL)
#15 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\SpecBaseObject.php(387): cebe\openapi\spec\Paths->resolveReferences(NULL)
#16 D:\Development\PHP\5g_api\vendor\cebe\php-openapi\src\Reader.php(134): cebe\openapi\SpecBaseObject->resolveReferences()
#17 D:\Development\PHP\5g_api\bin\generator.php(7): cebe\openapi\Reader::readFromYamlFile('D:\\Development\\...')
#18 {main}

Based on the issue, I've downgraded to 1.4.2 and that executes without a problem.

from php-openapi.

samizdam avatar samizdam commented on August 21, 2024

After upgrade to 1.5.1 I'm get cebe\openapi\exceptions\UnresolvableReferenceException on reference in referenced file:
https://github.com/FreeElephants/json-api-php-toolkit/runs/2539120065?check_suite_focus=true#step:9:15

from php-openapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.