Skip to content

MVP array config item vals#843

Draft
philmillman wants to merge 2 commits into
mainfrom
feature/array-obj-values
Draft

MVP array config item vals#843
philmillman wants to merge 2 commits into
mainfrom
feature/array-obj-values

Conversation

@philmillman

Copy link
Copy Markdown
Member

No description provided.

@philmillman philmillman requested a review from theoephraim June 26, 2026 15:28
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
varlock-website 44f694e Commit Preview URL

Branch Preview URL
Jun 26 2026, 03:30 PM

@github-actions

Copy link
Copy Markdown
Contributor

bumpy-frog

The changes in this PR will be included in the next version bump.

minor Minor releases

  • @env-spec/parser 0.4.1 → 0.5.0
  • env-spec-language 0.2.4 → 0.3.0
  • varlock 1.9.0 → 1.10.0

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@pkg-pr-new

pkg-pr-new Bot commented Jun 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@env-spec/parser@843
npm i https://pkg.pr.new/varlock@843

commit: 44f694e

- `separator` (string) — split string input (e.g. `","` for comma-separated `.env` values)
- `allowEmpty` (boolean) — allow `[]` (default: false)

Named options not listed above are forwarded to the element type (e.g. `normalize=true` on `array(email, …)`).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is weird

**Element type** — first positional argument: a type name (`string`, `email`, …) or a nested call for types with positional args (`enum(dev, staging, prod)`).

**Array options:**
- `minLength` / `maxLength` — element count bounds

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probable want an isLength too to match our string type

**Array options:**
- `minLength` / `maxLength` — element count bounds
- `unique` (boolean) — reject duplicate elements
- `separator` (string) — split string input (e.g. `","` for comma-separated `.env` values)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both in terms of input and output, we may need some options around quotes and brackets.

For example, all these seem like reasonable inputs - a,b,c, [a,b,c], ["a", "b", "c"]
All of them could be parsed and the type-safe output will be fine, but the its not clear how we'd serialzie it back to a string for the basic env var. Also probably want to enable/disable basic splitting

Id assume default is that splitting by comma is fine, and no quotes needed, since if youre using an env var today to pass in a list, its probably just a,b,c

env-spec-language: minor
---

Add `@type=array(...)` for list-valued config items with per-element validation, array literal values, JSON and comma-separated input, and `T[]` type generation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My debate internally had been whether to do wrap the type in array() or to split it into a new decorator --
@type=string(startsWith=abc) @arrayType(minLength=2)

Obviously wrapping is a bit more correct, but since our type stuff doesnt actually use normal function calls like the rest of the system I thought it might be cleaner. Also do we want to support nested arrays?

Im not set on it, but curious what you think.

Also - we may as well support object (record/dictionary) too with this work? I dont think arbitrary shaped objects like we had in dmno, but just setting the value type, and optionally the key type.
dictionary(uuid, keyType=string(isLength=2), minKeyCount=2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants