caddy-json-schema: unexpected end of JSON input

Hey,

go: 1.17.2 caddy: 2.4.5

$ xcaddy build v2.4.5 --with github.com/abiosoft/caddy-json-schema
$ ./caddy json-schema -no-cache
json-schema discarding cache for root config.
json-schema fetching https://caddyserver.com/api/docs/config/ ...
json-schema 
json-schema discarding cache for apps/exec.
json-schema fetching https://caddyserver.com/api/docs/config/apps/exec ...
json-schema 
json-schema discarding cache for apps/supervisor.
json-schema fetching https://caddyserver.com/api/docs/config/apps/supervisor ...
json-schema 
json-schema discarding cache for apps/http.
json-schema fetching https://caddyserver.com/api/docs/config/apps/http ...
json-schema 
json-schema discarding cache for apps/pki.
json-schema fetching https://caddyserver.com/api/docs/config/apps/pki ...
json-schema 
json-schema discarding cache for apps/tls.
json-schema fetching https://caddyserver.com/api/docs/config/apps/tls ...
json-schema 
json-schema discarding cache for apps/auth.
json-schema fetching https://caddyserver.com/api/docs/config/apps/auth ...
json-schema 
json-schema: unexpected end of JSON input

The url https://caddyserver.com/api/docs/config/apps/auth response is empty with 502 error code.

Might not be a good idea to use the web server from caddy itself, it’s an external services which can always change. Like in my case it looks like auth is gone?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 5
  • Comments: 18 (1 by maintainers)

Most upvoted comments

That’s weird. Looks like something is wrong with the site for those docs (JS errors) – sigh, sorry about that. I will have to look into that as soon as I have a chance. (And I’ve noticed some docs where the yellow box explaining where the non-standard module’s repo can be found is missing… hmm.)

Fixed in https://github.com/abiosoft/caddy-json-schema/pull/8 You can test it out using my fork https://github.com/fedorg/caddy-json-schema It contains build instructions for Docker and a gist with the generated schema file.

Was going to note that I was still hitting this when generating the schema for 2.5.0 but I see now that there’s a PR to fix it which is great. If anyone is keeping track of which plugins have this doc issue, I hit it for all 3 of the ones I mentioned before plus one new one. Here’s the current list of the plugins I had to manually fix docs.json for:

  • apps/http.handlers.prometheus
  • apps/http.handlers.request_debug
  • apps/http.handlers.image_filter
  • apps/http.handlers.olaf

Running into this when building docs for https://github.com/mholt/caddy-l4.

Dockerfile

RUN \
    apk update \
    && apk add $run_deps \
    && go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest \
    \
    # https://caddyserver.com/docs/modules/layer4
    # https://caddyserver.com/docs/build
    && /root/go/bin/xcaddy build ${CADDY_VERSION} \
        --with github.com/abiosoft/caddy-json-schema \
        --with github.com/mholt/caddy-l4/layer4 \
    \
    && mv caddy /usr/local/bin

Build command:

 # caddy json-schema --vscode --output /out/caddy_schema.json

Output:

json-schema cached docs not found for root config.
json-schema fetching https://caddyserver.com/api/docs/config/ ...
json-schema
json-schema cached docs not found for apps/exec.
json-schema fetching https://caddyserver.com/api/docs/config/apps/exec ...
json-schema
json-schema cached docs not found for apps/supervisor.
json-schema fetching https://caddyserver.com/api/docs/config/apps/supervisor ...
json-schema
json-schema cached docs not found for apps/http.
json-schema fetching https://caddyserver.com/api/docs/config/apps/http ...
json-schema
json-schema cached docs not found for apps/pki.
json-schema fetching https://caddyserver.com/api/docs/config/apps/pki ...
json-schema
json-schema cached docs not found for apps/tls.
json-schema fetching https://caddyserver.com/api/docs/config/apps/tls ...
json-schema
json-schema cached docs not found for apps/security.
json-schema fetching https://caddyserver.com/api/docs/config/apps/security ...
json-schema
json-schema cached docs not found for apps/crowdsec.
json-schema fetching https://caddyserver.com/api/docs/config/apps/crowdsec ...
json-schema
json-schema cached docs not found for apps/dynamic_dns.
json-schema fetching https://caddyserver.com/api/docs/config/apps/dynamic_dns ...
json-schema
json-schema cached docs not found for apps/layer4.
json-schema fetching https://caddyserver.com/api/docs/config/apps/layer4 ...
json-schema
json-schema cached docs not found for apps/layer4.matchers.crowdsec.
json-schema fetching https://caddyserver.com/api/docs/config/apps/layer4.matchers.crowdsec ...
json-schema
json-schema cached docs not found for apps/caddy.logging.writers.stdout.
json-schema fetching https://caddyserver.com/api/docs/config/apps/caddy.logging.writers.stdout ...
json-schema
json-schema cached docs not found for apps/http.matchers.exec_noop.
json-schema fetching https://caddyserver.com/api/docs/config/apps/http.matchers.exec_noop ...
json-schema
json-schema cached docs not found for apps/http.matchers.execnopmatch.
json-schema fetching https://caddyserver.com/api/docs/config/apps/http.matchers.execnopmatch ...
json-schema
json-schema cached docs not found for apps/http.handlers.geofence.
json-schema fetching https://caddyserver.com/api/docs/config/apps/http.handlers.geofence ...
json-schema
json-schema cached docs not found for apps/dns.providers.lego_deprecated.
json-schema fetching https://caddyserver.com/api/docs/config/apps/dns.providers.lego_deprecated ...
json-schema
json-schema cached docs not found for apps/caddy.logging.encoders.filter.
json-schema fetching https://caddyserver.com/api/docs/config/apps/caddy.logging.encoders.filter ...
json-schema
json-schema cached docs not found for apps/http.handlers.request_debug.
json-schema fetching https://caddyserver.com/api/docs/config/apps/http.handlers.request_debug ...
json-schema
json-schema: unexpected end of JSON input

I’m not a Go or Caddy expert, so maybe I’m doing something wrong?