CafuChino / caddy-json-types

2 stars 0 forks source link

Missing type for IModulesCaddyhttpRoute.handle #1

Closed onlywei closed 2 months ago

onlywei commented 2 months ago

Seems like IModulesCaddyhttpRoute.handle is of type Array<unknown>. What's the reason it was set to unknown? Seems to me like it's an object that looks like:

{
  "handler": "reverse_proxy",
  "headers": {
    "request": {
      "set": {
        "Host": [
          "{http.reverse_proxy.upstream.hostport}"
        ]
      }
    }
  },
  "transport": {
    "protocol": "http",
    "tls": {}
  },
  "upstreams": [
    {
      "dial": "www.somewhere.com:443"
    }
  ]
}
CafuChino commented 2 months ago

This is a known issue. In the current version, the definitions of some Caddy modules could not be properly extracted and parsed from the documentation, which led to them automatically falling back to an "unknown" status. Although I have attempted to address and resolve some of these issues, they have not been fully resolved yet.

During the process of addressing this problem, I have also made changes to the naming conventions for interfaces. This may cause difficulties for other projects that are using these interfaces. As a result, I plan to continue refining the generation method for interface files.

In the meantime, I will be releasing an alpha version of the partially adjusted new typings definitions. This should help address your immediate needs.

Please feel free to reach out if you have any further questions or concerns.

CafuChino commented 2 months ago

https://github.com/CafuChino/caddy-json-types/commit/d967842552a246404c5947b100de6abb2938dc4c

Try 1.0.3-alpha.0