Giter VIP home page Giter VIP logo

Comments (18)

mholt avatar mholt commented on June 8, 2024 4

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.)

from caddy-json-schema.

fedorg avatar fedorg commented on June 8, 2024 3

Fixed in #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.

from caddy-json-schema.

AlexanderAllen avatar AlexanderAllen commented on June 8, 2024 1

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?

from caddy-json-schema.

mdegat01 avatar mdegat01 commented on June 8, 2024 1

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

from caddy-json-schema.

Gr33nbl00d avatar Gr33nbl00d commented on June 8, 2024

I can reproduce this, maybe should be reported to caddy project.
Menawhile as a workarround editing the cached json files and remove relevant configs can make it work again

from caddy-json-schema.

sharnoff avatar sharnoff commented on June 8, 2024

Just in case anyone else is coming across this, I found that the following file was sufficient:

{"status_code":200}

These were in <caddy/json_schema/<doc name>/docs.json. At time of writing, the docs that required this were:

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

from caddy-json-schema.

francislavoie avatar francislavoie commented on June 8, 2024

This should now be fixed, see caddyserver/website#206. Could any of you give this a try again?

from caddy-json-schema.

mdegat01 avatar mdegat01 commented on June 8, 2024

@francislavoie just hit this, from a different endpoint though. I see it from apps/http.handlers.prometheus:

json-schema cached docs not found for apps/http.handlers.prometheus.
json-schema fetching https://caddyserver.com/api/docs/config/apps/http.handlers.prometheus ...
json-schema
json-schema: unexpected end of JSON input

from caddy-json-schema.

francislavoie avatar francislavoie commented on June 8, 2024

I don't think that plugin was registered on the Caddy website, so there's no docs for it. But either way, metrics are built into Caddy now, so that plugin shouldn't be necessary 🤔

from caddy-json-schema.

mdegat01 avatar mdegat01 commented on June 8, 2024

Ok I get it, there's a race condition to see which one breaks first. So of the ones sharnoff listed above endpoints for the following 3 were returning 502 and were stopping json schema generation:

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

After manually putting json files into the cache for those 3 generation completed susccessfully. I did not have to touch anything for apps/auth so it looks like that one is fixed.

I'm not really sure why its pulling in prometheus if it shouldn't @francislavoie . I don't use prometheus so I'm not building in an extension around it with xcaddy. Perhaps its on a list and needs to be removed? All 3 of those modules say "non-standard" in the docs so seems like they're being incorrectly included.

from caddy-json-schema.

francislavoie avatar francislavoie commented on June 8, 2024

The "non-standard" label means it's not included with vanilla Caddy, i.e. a third party plugin.

Also, I was wrong that they aren't registered on the website, they are listed here: https://caddyserver.com/docs/modules/ but I don't see which Go module they come from 🤔

I think @mholt will need to take a look at why those are causing issues. I don't have direct access to the website backend.

from caddy-json-schema.

mholt avatar mholt commented on June 8, 2024

Ok, I think it's just that the auth plugin was moved/renamed to security: https://caddyserver.com/docs/modules/security

And that does seem to work fine.

from caddy-json-schema.

mholt avatar mholt commented on June 8, 2024

@AlexanderAllen Those paths look broken, starting with /api/docs/config/apps/layer4.matchers.crowdsec -- there is no app named layer4.matchers.crowdsec; the correct link should probably be https://caddyserver.com/api/docs/module/http.handlers.request_debug, but this is different than config-traversal docs, if that makes sense. I'm not sure what is generating those paths but it seems to be an error.

(That particular module does not appear to have docs btw. There's JSON response but the docs are null. Hmm.)

from caddy-json-schema.

AlexanderAllen avatar AlexanderAllen commented on June 8, 2024

from caddy-json-schema.

francislavoie avatar francislavoie commented on June 8, 2024

We ship a caddy:builder image variant that you can use (see https://hub.docker.com/_/caddy) which is also based on Alpine. It's definitely not an issue with your build.

There's definitely a bug in caddy-json-schema that needs to be fixed, it's generating incorrect URLs for trying to fetch each module's docs.

from caddy-json-schema.

AlexanderAllen avatar AlexanderAllen commented on June 8, 2024

from caddy-json-schema.

crummy avatar crummy commented on June 8, 2024

I reproduced the issue:

docker run --rm -it caddy:builder sh
xcaddy build v2.4.6 --with github.com/abiosoft/caddy-json-schema
./caddy json-schema

Error is json-schema: unexpected end of JSON input

from caddy-json-schema.

mholt avatar mholt commented on June 8, 2024

Thanks @mdegat01 -- quite likely a bug in the docs system I wrote. I'm not sure what those have in common yet, though, so I'll need to find some time to take a look and see what's going on.

from caddy-json-schema.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.