APIDevTools / json-schema-ref-parser

Parse, Resolve, and Dereference JSON Schema $ref pointers in Node and browsers
https://apitools.dev/json-schema-ref-parser
MIT License
942 stars 226 forks source link

Dereferencing time out #340

Closed souhailaS closed 4 months ago

souhailaS commented 4 months ago

The dereferencing function takes a very long time in the case of some complex examples. I faced many times use cases where I needed to stop the function after some time. Since dereference is a synchronous recursive function, it is not possible to stop it from outside. A 'time spent' check is needed to add to the crawl function.

I did a little modification locally to the dereference and crawl functions, to pass a timeout in the options of the referencing function.

jonluca commented 4 months ago

Implemented in https://github.com/APIDevTools/json-schema-ref-parser/commit/c33ca65cf5a76588fd197a49f3325d1813417957