apiaryio / fury-adapter-swagger

Swagger 2.0 parser adapter for Fury.js
MIT License
11 stars 12 forks source link

Don't expand optional values in circular structures #212

Closed kylef closed 6 years ago

kylef commented 6 years ago

Using alwaysFakeOptionals with faker and JSON Schemas with circular references is a recipe for disaster. It can lead to JSON Schema Faker getting into an infinite loop when it requires an optional value to always be faked inside a circular referenced path.

Unfortunately, removing alwaysFakeOptionals means that the produced example JSON bodies with circular references are less deterministic because they can now randomly fake optional or not. Once we update to json-schema-faker 0.5.0-rc15 we can set optionalsProbability to zero so they will never be expanded which will be a more deterministic behaviour allowing us to restore the disable test in this PR.