cloudflare / workers-sdk

โ›…๏ธ Home to Wrangler, the CLI for Cloudflare Workersยฎ
https://developers.cloudflare.com/workers/
Apache License 2.0
2.58k stars 664 forks source link

๐Ÿš€ Feature Request: Expand validateAdditionalProperties to more configuration types #2586

Open KianNH opened 1 year ago

KianNH commented 1 year ago

Describe the solution

The current usage of validateAdditionalProperties is only used for a subset of configuration fields, such as build or the top-level entries.

This means that you can use the following TOML and whilst it will publish with no warnings, route won't work and nor will you get warnings about that or the unknown i_dont_exist field.

name = "test-worker"
main = "src/index.ts"
compatibility_date = "2023-01-11"

[[kv_namespaces]]
binding = "KV"
id = ""
preview_id = ""

route = { pattern = "example.com/*", zone_name = "example.com" }

[[r2_buckets]]
binding = "R2"
bucket_name = ""
preview_bucket_name = ""

i_dont_exist = "foo"

Relevant file: https://github.com/cloudflare/wrangler2/blob/main/packages/wrangler/src/config/validation.ts

In my opinion, I don't see the downside to running it on everything other than unsafe bindings?

mrbbot commented 1 year ago

Hey! ๐Ÿ‘‹ This seems like a good idea, especially given TOML format confusions. ๐Ÿ‘