xeipuuv / gojsonschema

An implementation of JSON Schema, draft v4 v6 & v7 - Go language
2.57k stars 358 forks source link

Retry on "Could not read schema from HTTP, response status is 503 Service Temporarily Unavailable" #359

Open mrutkows opened 1 year ago

mrutkows commented 1 year ago

Recently, I randomly started to encounter the 503 error when validating against local schemas (ByteLoader) that appears to reference remote schemas (over http)... I did not realize I was for some time that this error was likely due to being on an unreliable Wifi network...

Would there be a way to add a "retry" (default 3x or configurable) to any external HTTP loads of ref. schemas?

OR even better, allow for me to tell the loader to NOT find the schemas at their remote (http) locations, but instead find them locally (i.e., I would likely include them as a Go embedded resource along with the base schemas that reference them)?

mrutkows commented 1 year ago

The second option... i.e., to effectively tell the loader to resolve http to local is highly desirable in "closed" build systems/environments where external network access is intentionally shut off.

jsteenb2 commented 1 year ago

+1 to the resolve http to local or embedded. I'd be happy to create a PR for this would be accepted upstream?