Skip to content

Commit

Permalink
Wrangler capnp compilation (#3610)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skye-31 committed Jul 27, 2023
1 parent f753f3a commit bfbe49d
Show file tree
Hide file tree
Showing 17 changed files with 461 additions and 134 deletions.
7 changes: 7 additions & 0 deletions .changeset/fast-kids-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Wrangler Capnp Compilation

This PR replaces logfwdr's `schema` property with a new `unsafe.capnp` object. This object accepts either a `compiled_schema` property, or a `base_path` and array of `source_schemas` to get Wrangler to compile the capnp schema for you.
8 changes: 4 additions & 4 deletions packages/wrangler/src/__tests__/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2648,7 +2648,7 @@ describe("normalizeAndValidateConfig()", () => {
`);
});

it("should error if neither unsafe.bindings nor unsafe.metadata are defined", () => {
it("should error if unsafe.bindings, unsafe.metadata and unsafe.capnp are undefined", () => {
const { diagnostics } = normalizeAndValidateConfig(
{ unsafe: {} } as unknown as RawConfig,
undefined,
Expand All @@ -2661,7 +2661,7 @@ describe("normalizeAndValidateConfig()", () => {
`);
expect(diagnostics.renderErrors()).toMatchInlineSnapshot(`
"Processing wrangler configuration:
- The field \\"unsafe\\" should contain at least one of \\"bindings\\" or \\"metadata\\" properties but got {}."
- The field \\"unsafe\\" should contain at least one of \\"bindings\\", \\"metadata\\" or \\"capnp\\" properties but got {}."
`);
});

Expand Down Expand Up @@ -4202,7 +4202,7 @@ describe("normalizeAndValidateConfig()", () => {
`);
});

it("should error if neither unsafe.bindings nor unsafe.metadata are defined", () => {
it("should error if unsafe.bindings, unsafe.metadata and unsafe.capnp are undefined", () => {
const { diagnostics } = normalizeAndValidateConfig(
{ env: { ENV1: { unsafe: {} } } } as unknown as RawConfig,
undefined,
Expand All @@ -4219,7 +4219,7 @@ describe("normalizeAndValidateConfig()", () => {
"Processing wrangler configuration:
- \\"env.ENV1\\" environment configuration
- The field \\"env.ENV1.unsafe\\" should contain at least one of \\"bindings\\" or \\"metadata\\" properties but got {}."
- The field \\"env.ENV1.unsafe\\" should contain at least one of \\"bindings\\", \\"metadata\\" or \\"capnp\\" properties but got {}."
`);
});

Expand Down
Loading

0 comments on commit bfbe49d

Please sign in to comment.