Comments (8)
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.
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.
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.
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.
@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.
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.
@fredbi looks good. Thanks
from spec.
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)
- Bearer Auth Security Scheme HOT 4
- Spec file is not correctly generated for map to list in struct HOT 2
- Heavy init() calls dramatically slow down tests HOT 3
- heads up: codecov.io security incident - https://about.codecov.io/security-update/ HOT 1
- go-swagger throws error on Windows if application path contains parentheses or blanks HOT 4
- `AdditionalProperties` doesn't differ empty schema or explicit `false` HOT 1
- High vulnerability in golang.org/x/text
- Description for API Key Security Scheme
- spec OrderSchemaItems.Less panic on reflect.ValueOf(ii).Int()
- [Q] swag dependency HOT 2
- Add Notice file to complete the Apache-2.0 requirements HOT 3
- github.com/go-openapi/[email protected]: verifying module: checksum mismatch HOT 4
- TestNormalize fails with Go 1.19
- Vulnerability Reported for Slack Webhook by Gitleaks Secret Detection HOT 1
- `x-order` require value of `number` to be in quotes
- YAML declarations in SchemaProps struct HOT 1
- Spec parser ignores response entries when there's an extension
- Is this an exposed secret? HOT 2
- Expander: the expanded spec is unusable to resolve circular $ref
- Expander: when expanding with SkipSchema, the relative path is lost
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spec.