Skip to content

Commit

Permalink
chore(deps): update dependencies valibot from v0.30.0 to v0.31.1 (#79)
Browse files Browse the repository at this point in the history
* feat(deps): update dependencies valibot from v0.30.0 to v0.31.1

* fix type issue

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Dan Adajian <dadajian@expediagroup.com>
  • Loading branch information
renovate[bot] and danadajian authored Jun 11, 2024
1 parent 6f3e468 commit 086877e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@graphql-codegen/plugin-helpers": "5.0.4",
"@graphql-codegen/visitor-plugin-common": "5.2.0",
"ts-deepmerge": "7.0.0",
"valibot": "0.30.0"
"valibot": "0.31.1"
},
"devDependencies": {
"@graphql-codegen/cli": "5.0.2",
Expand Down
13 changes: 3 additions & 10 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import {
ParsedConfig,
RawConfig,
} from "@graphql-codegen/visitor-plugin-common";
import { Input, safeParse } from "valibot";
import { InferInput, safeParse } from "valibot";
import { configSchema } from "./config/schema";
import { buildConfigWithDefaults } from "./config/build-config-with-defaults";
import { addDependentTypesToOnlyTypes } from "./config/add-dependent-types-to-only-types";
import { visit } from "graphql";

export type GraphQLKotlinCodegenConfig = Partial<RawConfig & ParsedConfig> &
Input<typeof configSchema>;
InferInput<typeof configSchema>;

export const plugin: PluginFunction<GraphQLKotlinCodegenConfig> = (
schema,
Expand All @@ -40,14 +40,7 @@ export const plugin: PluginFunction<GraphQLKotlinCodegenConfig> = (
}
const { issues } = safeParse(configSchema, config);
if (issues) {
throw new Error(
issues
.map(
(issue) =>
`${issue.path?.[0]?.key} must be ${issue.expected} (${issue.input} was provided)`,
)
.join("\n"),
);
throw new Error(issues.map((issue) => issue.message).join("\n"));
}

const configWithDefaults = buildConfigWithDefaults(config, info.outputFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { GraphQLKotlinCodegenConfig } from "../../../src/plugin";
export default {
// @ts-expect-error - invalid config
onlyTypes: 2,
expectedErrorMessage: "onlyTypes must be Array (2 was provided)",
expectedErrorMessage: "Invalid type: Expected Array but received 2",
} satisfies GraphQLKotlinCodegenConfig;

0 comments on commit 086877e

Please sign in to comment.