Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/publish-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ jobs:
publish-npm:
if: github.event.release.prerelease == false
runs-on: ubuntu-22.04
env:
# quicktype-core's build (packages/quicktype-core/env.sh) swaps in
# a CI-only fetch shim whenever $CI is set — which GitHub Actions
# always sets. PUBLISH=true makes it skip that swap so releases
# ship the real $fetch (issue #2874).
PUBLISH: "true"
permissions:
# Required for npm Trusted Publishing (OIDC): npm mints
# short-lived, per-run credentials from this token instead
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/publish-vscode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ jobs:
runs-on: ubuntu-22.04
permissions:
contents: read
env:
# quicktype-core's build (packages/quicktype-core/env.sh) swaps in
# a CI-only fetch shim whenever $CI is set — which GitHub Actions
# always sets. PUBLISH=true makes it skip that swap so the bundled
# extension ships the real $fetch (issue #2874).
PUBLISH: "true"
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
name: Setup
description: Setup common stuff for jobs
inputs:
node-version:
description: Node.js version to install; defaults to .nvmrc
required: false
default: ""
runs:
using: "composite"
steps:
- name: Setup environment
shell: bash
run: |
NODE_VERSION=$(cat .nvmrc | xargs)
NODE_VERSION="${{ inputs.node-version }}"
if [[ -z "$NODE_VERSION" ]]; then
NODE_VERSION=$(cat .nvmrc | xargs)
fi
echo "node_version=$NODE_VERSION" >> $GITHUB_ENV

# Create keys to control caching
BASE_KEY="${{ runner.os }}"

NODE_MODULES_KEY="$BASE_KEY-${{ hashFiles('package-lock.json') }}"
echo "node_modules_key=$NODE_MODULES_KEY" >> $GITHUB_ENV

SOURCE_KEY="$NODE_MODULES_KEY-${{ hashFiles('src/**') }}"
echo "source_key=$SOURCE_KEY" >> $GITHUB_ENV

- name: Setup node
uses: actions/setup-node@v4
with:
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ on:
pull_request:
jobs:
build:
name: Build and unit tests (Node ${{ matrix.node-version }})
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
node-version: ["20", "24"]
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
with:
node-version: ${{ matrix.node-version }}
- run: npm run test:unit
- run: node dist/index.js --version
- name: Run representative fixtures on the minimum Node version
if: ${{ matrix.node-version == '20' }}
run: CPUs=2 QUICKTEST=true FIXTURE=javascript,typescript npm run test:fixtures -- test/inputs/json/samples/pokedex.json

test:
needs: [build]
Expand Down Expand Up @@ -189,7 +201,7 @@ jobs:
elixir-version: "1.15.7"
otp-version: "26.0"

- run: QUICKTEST=true FIXTURE=${{ matrix.fixture }} npm test
- run: QUICKTEST=true FIXTURE=${{ matrix.fixture }} npm run test:fixtures

test-complete:
if: ${{ cancelled() || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'failure') }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22.14.0
v24.6.0
27 changes: 18 additions & 9 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Notes for coding agents working in this repository.
## Environment

- This is a TypeScript/npm monorepo using npm workspaces.
- Prefer the Node version from `.nvmrc` (`nvm use`; currently Node 22.14.0). `package.json` requires Node >= 18.12.0.
- Prefer the Node version from `.nvmrc` (`nvm use`; currently Node 24.6.0). Published packages support Node >= 20.
- Install dependencies with `npm ci`.

## Build and run
Expand All @@ -29,25 +29,34 @@ Notes for coding agents working in this repository.

## Tests

- The test runner is `script/test`, exposed as:
- Vitest runs the standalone unit and regression tests:

```bash
npm test
npm run test:unit
npm run test:unit:watch
```

- The cross-language fixture runner remains `script/test`, exposed as:

```bash
npm run test:fixtures
```

- `npm test` runs the Vitest suite followed by the fixture suite.

- The full suite runs all fixtures and needs external language toolchains for many targets (`dotnet`, Java/Maven, Go, Rust, Python/mypy, PHP, Ruby, Kotlin, Scala, Elixir, etc.). On a machine without those tools, plain `npm test` will fail when it reaches the first missing toolchain.

- For local focused testing, use fixture filters. Fixture names are in `test/languages.ts` and `test/fixtures.ts`; comma-separated fixture groups are supported:

```bash
QUICKTEST=true FIXTURE=javascript npm test
QUICKTEST=true FIXTURE=typescript npm test -- test/inputs/json/samples/pokedex.json
CPUs=2 QUICKTEST=true FIXTURE=javascript npm test
QUICKTEST=true FIXTURE=javascript npm run test:fixtures
QUICKTEST=true FIXTURE=typescript npm run test:fixtures -- test/inputs/json/samples/pokedex.json
CPUs=2 QUICKTEST=true FIXTURE=javascript npm run test:fixtures
```

`QUICKTEST=true` skips the large miscellaneous JSON input set. Extra arguments after `--` are sample files or directories to run.

- GitHub Actions uses the same pattern, e.g. `QUICKTEST=true FIXTURE=${{ matrix.fixture }} npm test`, after installing toolchain dependencies for each fixture group in `.github/workflows/test-pr.yaml`.
- GitHub Actions uses the same pattern, e.g. `QUICKTEST=true FIXTURE=${{ matrix.fixture }} npm run test:fixtures`, after installing toolchain dependencies for each fixture group in `.github/workflows/test-pr.yaml`.

## Validation performed

Expand All @@ -57,8 +66,8 @@ The following commands were run successfully in this workspace:
npm ci
npm run build
node dist/index.js --version
CPUs=2 QUICKTEST=true FIXTURE=javascript npm test
QUICKTEST=true FIXTURE=typescript npm test -- test/inputs/json/samples/pokedex.json
CPUs=2 QUICKTEST=true FIXTURE=javascript npm run test:fixtures
QUICKTEST=true FIXTURE=typescript npm run test:fixtures -- test/inputs/json/samples/pokedex.json
```

Also observed: `npm test` without fixture filters started the full 70-fixture suite and failed on this machine because `dotnet` is not installed. `npm run lint` currently fails because ESLint cannot find a configuration file.
2 changes: 1 addition & 1 deletion COMMENT-INJECTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The schema puts comment-closing text in both an object `description` and a prope
Run:

```bash
CPUs=1 QUICKTEST=true FIXTURE=schema-typescript npm test -- test/inputs/schema/comment-injection.schema
CPUs=1 QUICKTEST=true FIXTURE=schema-typescript npm run test:fixtures -- test/inputs/schema/comment-injection.schema
```

Expected result: the generated TypeScript validates `comment-injection.1.json` and prints equivalent JSON.
Expand Down
17 changes: 17 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Migrating to quicktype 24
Comment thread
schani marked this conversation as resolved.

quicktype 24 raises the minimum supported Node.js version to Node 20. The
project itself is built, tested, and published with Node 24, while CI also
builds and tests the supported Node 20 floor.

The CLI and published libraries now use the native `fetch` implementation
provided by Node.js and modern browsers. Applications running quicktype on a
supported Node.js version do not need to install or configure a fetch
polyfill.

There are no intentional changes to generated code or the public quicktype
API in this release. TypeScript compiler versions are also unchanged.

For contributors, `npm run test:unit` runs the Vitest regression suite and
`npm run test:fixtures` runs the cross-language fixture harness. `npm test`
runs both suites.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ _Missing your favorite language? Please implement it!_

There are many ways to use `quicktype`. [app.quicktype.io](https://app.quicktype.io) is the most powerful and complete UI. The web app also works offline and doesn't send your sample data over the Internet, so paste away!

The quicktype CLI and Node.js packages require Node.js 20 or newer. See
[Migrating to quicktype 24](MIGRATING.md) for upgrade details.

For the best CLI, we recommend installing `quicktype` globally via `npm`:

```bash
Expand Down Expand Up @@ -247,13 +250,16 @@ files, URLs, or add other options.
### Test

```bash
# Run full test suite
npm run test
# Run full test suite (unit tests plus all fixtures)
npm test

# Run only the Vitest unit tests
npm run test:unit

# Test a specific language (see test/languages.ts)
FIXTURE=golang npm test
FIXTURE=golang npm run test:fixtures

# Test a single sample or directory
FIXTURE=swift npm test -- pokedex.json
FIXTURE=swift npm test -- test/inputs/json/samples
FIXTURE=swift npm run test:fixtures -- pokedex.json
FIXTURE=swift npm run test:fixtures -- test/inputs/json/samples
```
Loading
Loading