Skip to content
Merged
2 changes: 1 addition & 1 deletion .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
# - swift,schema-swift # pgp issue
- javascript-prop-types
- ruby
- php
- php,schema-php
- scala3,schema-scala3
- elixir,schema-elixir,graphql-elixir
- comment-injection-treesitter,comment-injection-typescript,comment-injection-typescript-zod,comment-injection-typescript-effect-schema
Expand Down
27 changes: 27 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Repository conventions

## Testing

quicktype's primary testing method is end-to-end fixture tests driven by JSON
and JSON Schema files. For each sample input, the fixture generates code for a
language, runs a driver program in `test/fixtures/<language>/` that
deserializes the sample and serializes it back, and compares the round-tripped
JSON to the input.

- JSON inputs live in `test/inputs/json/`: `priority/` and `samples/` always
run, `misc/` is skipped under `QUICKTEST` (and for languages with
`skipMiscJSON`).
- JSON Schema inputs live in `test/inputs/schema/`: each `*.schema` comes with
`.N.json` samples and `.N.fail.<feature>.json` expected-failure samples. A
fail sample must make the generated program exit nonzero; which fail
samples run is controlled by the language's `features` list.
- Per-language configuration — which inputs run (`skipJSON`, `includeJSON`,
`skipSchema`), renderer options, and `features` — lives in
`test/languages.ts`; fixtures are registered in `test/fixtures.ts`.
- Run one language's fixtures with `FIXTURE=<name> script/test`, for example
`FIXTURE=php script/test` or `FIXTURE=schema-php script/test`.

Any change that affects generated output MUST be covered by a JSON or JSON
Schema fixture test — by enabling existing inputs for the language or adding
new ones. Unit tests in `test/unit/` are a complement for what fixtures cannot
express (asserting that some code is *not* generated, API-level behavior, fast
local iteration) — never a substitute.

## Releasing / version bumps

Do not bump versions in any `package.json` before a release. Package manifest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ export class NewtonsoftCSharpRenderer extends CSharpRenderer {
private readonly _options: OptionValues<typeof newtonsoftCSharpOptions>,
) {
super(targetLanguage, renderContext, _options);
this._needHelpers = _options.features.helpers;
this._needAttributes = _options.features.attributes;
// `--just-types` wins over whatever `--features` says.
this._needHelpers = _options.features.helpers && !_options.justTypes;
this._needAttributes =
_options.features.attributes && !_options.justTypes;
this._needNamespaces = _options.features.namespaces;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ export class SystemTextJsonCSharpRenderer extends CSharpRenderer {
>,
) {
super(targetLanguage, renderContext, _options);
this._needHelpers = _options.features.helpers;
this._needAttributes = _options.features.attributes;
// `--just-types` wins over whatever `--features` says.
this._needHelpers = _options.features.helpers && !_options.justTypes;
this._needAttributes =
_options.features.attributes && !_options.justTypes;
this._needNamespaces = _options.features.namespaces;
}

Expand Down
11 changes: 1 addition & 10 deletions packages/quicktype-core/src/language/CSharp/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,10 @@ export const cSharpOptions = {
helpers: false,
attributes: true,
},
"just-types-and-namespace": {
namespaces: true,
helpers: false,
attributes: false,
},
"just-types": {
namespaces: true,
helpers: false,
attributes: false,
},
} as const,
"complete",
),
justTypes: new BooleanOption("just-types", "Plain types only", false),
baseclass: new EnumOption(
"base-class",
"Base class",
Expand Down
10 changes: 7 additions & 3 deletions packages/quicktype-core/src/language/Kotlin/language.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ConvenienceRenderer } from "../../ConvenienceRenderer.js";
import type { RenderContext } from "../../Renderer.js";
import {
BooleanOption,
EnumOption,
StringOption,
getOptionValues,
Expand All @@ -16,11 +17,11 @@ import { KotlinRenderer } from "./KotlinRenderer.js";
import { KotlinXRenderer } from "./KotlinXRenderer.js";

export const kotlinOptions = {
justTypes: new BooleanOption("just-types", "Plain types only", false),
framework: new EnumOption(
"framework",
"Serialization framework",
{
"just-types": "None",
jackson: "Jackson",
klaxon: "Klaxon",
kotlinx: "KotlinX",
Expand Down Expand Up @@ -62,9 +63,12 @@ export class KotlinTargetLanguage extends TargetLanguage<
): ConvenienceRenderer {
const options = getOptionValues(kotlinOptions, untypedOptionValues);

// `--just-types` wins over whatever `--framework` says.
if (options.justTypes) {
return new KotlinRenderer(this, renderContext, options);
}

switch (options.framework) {
case "None":
return new KotlinRenderer(this, renderContext, options);
case "Jackson":
return new KotlinJacksonRenderer(this, renderContext, options);
case "Klaxon":
Expand Down
Loading
Loading