Giter VIP home page Giter VIP logo

Comments (8)

fredbi avatar fredbi commented on August 20, 2024

The "isSeen" check is supposed to be the "parentRefs".
I found a first bug with unnormalized parent refs in isCircular, but this is not enough to resolve your test case.

from spec.

fredbi avatar fredbi commented on August 20, 2024

Looks like when the same $ref participates to several cycles, the simple path walking algorithm fails.
If I cache somewhere a memory of previous circular ref found, the hang is resolved.
Let's see how it goes with more extended tests...

from spec.

fredbi avatar fredbi commented on August 20, 2024

My solution works, but not as expected: depending on which cycle was first detected, the expanded result varies from run to run. Trying another way...

from spec.

fredbi avatar fredbi commented on August 20, 2024

Here is a more tractable test case demonstrating this issue.

swagger: "2.0"
info: 
  version: "0.0.1"
basePath: "/"
paths: 
  /cycles: 
    get: 
      responses: 
        200: 
          description: "ok"
          schema: 
            $ref: "#/definitions/node0"
definitions: 
  node0:
    type: object
    properties:
      p00:
        $ref: '#/definitions/node1'
      p01:
        $ref: '#/definitions/node3'
  node1:
    type: object
    properties:
      p1:
        $ref: '#/definitions/node2'
  node2:
    type: object
    properties:
      p2:
        $ref: '#/definitions/node0'
  node3:
    type: object
    properties:
      p3:
        $ref: '#/definitions/node1'

from spec.

fredbi avatar fredbi commented on August 20, 2024

@elakito I did some research on this today and produced a PR which is more like a work around.

Your comments are welcome.

from spec.

fredbi avatar fredbi commented on August 20, 2024

Fixed with PR#81.
However there are some limitations with this fix, that I am going to detail in more targeted issues.

@elakito feel free to reopen this if you think we missed an important point.

from spec.

elakito avatar elakito commented on August 20, 2024

@fredbi looks good. Thanks

from spec.

fredbi avatar fredbi commented on August 20, 2024

Hello @elakito

While fixing this with @pytlesk4, it occurred that we covered this use case, but some more devious
issues still remain. I did not find time to open a specific issue on those.

So for the record:

  • expansion result with several cycles sharing a spec node remains non-deterministic, and the shortest cycle is not necessarily the one retained
  • when cycles are formed in a remote, the resulting $ref is left as remote, so the expanded result
    is not entirely contained in a single root

Those are tricky cases...

from spec.

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.