Skip to content
Merged
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
2 changes: 1 addition & 1 deletion packages/downgrader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Accepts the default OAS dialect, which adds `discriminator`, `xml`, `externalDoc
- CreateAPI 0.2, a Swift generator that reads 3.0 only, by default stops with `Enum "…" has no values` on a string `enum` with no string in it, as the `"null"` branch is. So a nullable `$ref`, enum or union, such as Zod's `z.enum(["a", "b"]).nullable()`, and a property of `type: "null"` alone, such as Zod's `z.null()`, fail the whole run, or with `--allow-errors` drop the schema or property that holds them.
- clientele 2.3 leaves out `enum` everywhere but in a component of its own, so it reads the `"null"` branch as a nullable string. A nullable `$ref`, to an enum or an object, and a nullable union of types other than strings then also take any string, and a property of `type: "null"` alone, such as Zod's `z.null()`, becomes an optional string. It reads 3.1 too, which keeps `{ type: "null" }`.
- guardrail 1.0.0-M1, which types every inline 3.1 schema as untyped JSON, so reads 3.0 in practice, makes each inline string `enum` in a `oneOf`, the `"null"` branch among them, an empty case class in its circe models. That class takes any value and writes it back as `{}`, so a nullable `$ref` or union, such as Zod's `z.union([z.string(), z.number()]).nullable()`, takes any value and writes null back as `{}`. A nullable enum, such as Zod's `z.enum(["a", "b"]).nullable()`, does that for each of its own values too.
- Hey API's Zod and Valibot plugins read the `"null"` branch as any value, so a union with null, such as a nullable `$ref`, accepts every value. Hey API also types an array as its item when the item holds an `enum` beside an `anyOf`, as a `type` list with an `enum` becomes, such as Valibot's `picklist` of strings and numbers, so those plugins then reject the array. Its transformers plugin skips a union with the `"null"` branch, such as a nullable `$ref`, so the dates inside it stay strings, although its types say `Date`. Its Zod and Valibot plugins pin each branch of a `discriminator` to its tag when the tag is a one-value `enum`, as a `const` becomes, so they reject a value that leaves out a tag that has a `default`, such as Pydantic's `Literal["a"] = "a"` in a tagged union. Hey API reads 3.1 too, which keeps the `"null"` type, the `type` list, and the `const` tag, which it leaves as the branch says.
- Hey API's Zod and Valibot plugins read the `"null"` branch as any value, so a union with null, such as a nullable `$ref`, accepts every value. Hey API also types an array as its item when the item holds an `enum` beside an `anyOf`, as a `type` list with an `enum` becomes, such as Valibot's `picklist` of strings and numbers, so those plugins then reject the array. Hey API also drops a `{ type: "object" }` branch with nothing else in it from an `anyOf`, as a `type` list with `"object"` becomes, in a schema that holds a `readOnly` or `writeOnly` property, so its types and those plugins then reject an object there, such as Celigo's `encrypted` fields. Its transformers plugin skips a union with the `"null"` branch, such as a nullable `$ref`, so the dates inside it stay strings, although its types say `Date`. Its Zod and Valibot plugins pin each branch of a `discriminator` to its tag when the tag is a one-value `enum`, as a `const` becomes, so they reject a value that leaves out a tag that has a `default`, such as Pydantic's `Literal["a"] = "a"` in a tagged union. Hey API reads 3.1 too, which keeps the `"null"` type, the `type` list, and the `const` tag, which it leaves as the branch says.
- dtsgenerator 3.19, and the `typegen` of openapi-client-axios, which builds on it, put every value of an `enum` beside an `anyOf` into each branch, the shape a `type` list with an `enum` becomes, such as Valibot's `picklist` of strings and numbers. They type `picklist(["a", 1])` as `("a" | "1") | (a | 1)`, whose bare `a` does not compile and leaves the property open to any value. Both read 3.1 too, which keeps the `type` list.
- openapi-generator-plus 2.33's TypeScript clients read the `"null"` branch as an enum of the string `"null"`, so a nullable `$ref`, enum or union of scalars, which becomes a `oneOf` with that branch, takes that string in place of null in its type, as for Zod's `z.enum(["a", "b"]).nullable()`. Its parser also rejects `openapi: 3.0.4`, so set `3.0.3`. It reads 3.1 too, which keeps null, but stops on a `const` without a `type`, as Valibot and ArkType write a literal.
- openapi-to-rust 0.23, like openapi-generator-plus, reads the `"null"` branch as an enum of the string `"null"`, since it takes `enum: [null]` as null only without a `type`. So a nullable `$ref`, enum or union, such as Zod's `z.enum(["a", "b"]).nullable()`, becomes an `Option` of an untagged union with that enum as one more member, which also takes the string `"null"`, in place of an `Option` of the type itself. It reads 3.1 too, which keeps `{ type: "null" }`.
Expand Down
Loading