Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d6952f6
perf: make native local-model rendering linear in tag count
urbankrepel Oct 22, 2026
c1a581a
perf: render default options fully native
urbankrepel Oct 22, 2026
aa3ec14
chore: bump Bun to 1.4.3 and drop unused tsx
urbankrepel Oct 22, 2026
e0fadb4
chore: type-check with tsrs
urbankrepel Oct 22, 2026
1500f2a
refactor: remove `any` from src
urbankrepel Oct 22, 2026
d208bdd
build: publish v4 tags and ship an unstripped native addon
urbankrepel Oct 22, 2026
cdd7e9d
fix: accept any ErrorHandler in RestClient and NativeRestClient
urbankrepel Oct 22, 2026
a76130d
feat: type InvalidationMap callbacks from the generated mutations
urbankrepel Oct 22, 2026
4538c19
feat: type InvalidationMap<QueryModule> without naming the mutations
urbankrepel Oct 22, 2026
6693390
feat!: remove builder configs generation
urbankrepel Oct 22, 2026
dbfcaad
fix: type bare InvalidationMap and nested mutation variables
urbankrepel Oct 22, 2026
67745e9
chore: bump Bun to 1.4.4
urbankrepel Oct 23, 2026
9c207f1
Merge remote-tracking branch 'origin/main' into perf/native-default-r…
urbankrepel Oct 23, 2026
79383cd
fix: type lazySchemas render helpers with PropertyRefNames
urbankrepel Oct 23, 2026
e68cca0
fix: merge invalidation callback data and treat void as undefined
urbankrepel Oct 23, 2026
bfe8858
fix: remove trailing whitespace from generated files
urbankrepel Oct 23, 2026
bedc6e0
fix(native): match the TypeScript renderer on large specs
urbankrepel Oct 23, 2026
75ef908
feat: add includeSchemas to generate unused component schemas
urbankrepel Oct 23, 2026
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 .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.4.1
bun-version: 1.4.4

- uses: dtolnay/rust-toolchain@stable

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- v1.*
- v2.*
- v3.*
- v4.*

permissions:
id-token: write
Expand All @@ -21,7 +22,7 @@ jobs:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.4.1
bun-version: 1.4.4
- uses: dtolnay/rust-toolchain@stable
- run: bun install --frozen-lockfile
- run: bun run build:native
Expand All @@ -42,7 +43,7 @@ jobs:

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.4.1
bun-version: 1.4.4

- run: bun install --frozen-lockfile
- name: Set package version from tag
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/renderer-parity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.4.1"
bun-version: 1.4.4

- uses: dtolnay/rust-toolchain@stable
if: matrix.renderer == 'native'
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.4.1"
bun-version: 1.4.4

- run: bun install --frozen-lockfile

Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bun 1.4.1
bun 1.4.4
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ bunx openapi-codegen generate --config my-config.ts
--excludeTags Comma-separated list of tags to exclude from generation
--excludePathRegex Exclude operations whose paths match the given regular expression
--excludeRedundantZodSchemas Exclude any redundant Zod schemas (default: true)
--includeSchemas Comma-separated component schemas to generate even when no operation uses them

--tsNamespaces Wrap generated files in TypeScript namespaces (default: true)
--importPath Module import style for generated files (default: 'ts'; options: 'ts' | 'relative' | 'absolute')
Expand Down Expand Up @@ -148,7 +149,6 @@ bunx openapi-codegen generate --config my-config.ts
--acl Generate ACL related files (default: true)
--checkAcl Add ACL check to queries (default: true)

--builderConfigs Generate configs for builders (default: false)

--baseUrl (Requires `--restClientImportPath` to NOT be set) Base URL for the generated REST client; falls back to the OpenAPI spec if not provided
```
Expand All @@ -167,6 +167,7 @@ bunx openapi-codegen generate --config my-config.ts
--excludeTags Comma-separated list of tags to exclude from generation
--excludePathRegex Exclude operations whose paths match the given regular expression
--excludeRedundantZodSchemas Exclude any redundant Zod schemas (default: true)
--includeSchemas Comma-separated component schemas to generate even when no operation uses them
```

## Development
Expand Down Expand Up @@ -309,6 +310,24 @@ import { OpenApiQueryConfig } from "@povio/openapi-codegen-cli/query";
</OpenApiQueryConfig.Provider>;
```

### Typed invalidation maps

With `mutationEffects` (the default), `queryModules.ts` exports `QueryModuleMutations` (for each module, the `data` and `variables` of its mutation hooks) and registers it globally, so `InvalidationMap<QueryModule>` types each module's callback from the spec:

```ts
import type { InvalidationMap } from "@povio/openapi-codegen-cli/query";
import { QueryModule } from "@/data/queryModules";

export const invalidationMap: InvalidationMap<QueryModule> = {
// `data` is any of the module's mutation responses; variables that only some
// of its mutations take (here `id`) are optional.
[QueryModule.Items]: (data, { officeId, id }) => [["items", officeId, id]],
};
```

The registration is global, so a program with several generated clients should pass the mutations explicitly
instead: `InvalidationMap<QueryModule, QueryModuleMutations>`.

### Runtime response validation

Use `OpenApiQueryConfig.Provider` to allow generated GET query hooks to return invalid response data while still logging the response Zod error to the console. Non-GET requests still throw on invalid response data.
Expand Down
78 changes: 17 additions & 61 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ codegen-units = 1
lto = "fat"
opt-level = 3
panic = "abort"
strip = "symbols"
# Stripped dylibs fail to load on recent macOS ("mis-aligned LINKEDIT string pool").
strip = false

[profile.dev]
opt-level = 2
Expand Down
9 changes: 6 additions & 3 deletions native/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ pub struct GenerateOptions {
pub replace_optional_with_nullish: bool,
#[serde(default = "default_true")]
pub exclude_redundant_zod_schemas: bool,
#[serde(default)]
pub include_schemas: Vec<String>,
#[serde(default = "default_enum_suffix")]
pub enum_suffix: String,
#[serde(default)]
Expand All @@ -98,8 +100,6 @@ pub struct GenerateOptions {
pub parse_request_params: bool,
#[serde(default)]
pub inline_endpoints: bool,
#[serde(default)]
pub builder_configs: bool,
#[serde(default = "default_true")]
pub acl: bool,
#[serde(default)]
Expand Down Expand Up @@ -175,6 +175,9 @@ mod runtime_import_tests {
#[test]
fn mutation_effects_default_uses_query_subpath() {
let options: super::GenerateOptions = serde_json::from_str("{}").unwrap();
assert_eq!(options.mutation_effects_import_path, "@povio/openapi-codegen-cli/query");
assert_eq!(
options.mutation_effects_import_path,
"@povio/openapi-codegen-cli/query"
);
}
}
Loading
Loading