File tree Expand file tree Collapse file tree 4 files changed +5
-12
lines changed
test/unit/should_throw_config_validation_error Expand file tree Collapse file tree 4 files changed +5
-12
lines changed Original file line number Diff line number Diff line change 2323 "@graphql-codegen/plugin-helpers" : " 5.0.4" ,
2424 "@graphql-codegen/visitor-plugin-common" : " 5.2.0" ,
2525 "ts-deepmerge" : " 7.0.0" ,
26- "valibot" : " 0.30.0 "
26+ "valibot" : " 0.31.1 "
2727 },
2828 "devDependencies" : {
2929 "@graphql-codegen/cli" : " 5.0.2" ,
Original file line number Diff line number Diff line change @@ -20,14 +20,14 @@ import {
2020 ParsedConfig ,
2121 RawConfig ,
2222} from "@graphql-codegen/visitor-plugin-common" ;
23- import { Input , safeParse } from "valibot" ;
23+ import { InferInput , safeParse } from "valibot" ;
2424import { configSchema } from "./config/schema" ;
2525import { buildConfigWithDefaults } from "./config/build-config-with-defaults" ;
2626import { addDependentTypesToOnlyTypes } from "./config/add-dependent-types-to-only-types" ;
2727import { visit } from "graphql" ;
2828
2929export type GraphQLKotlinCodegenConfig = Partial < RawConfig & ParsedConfig > &
30- Input < typeof configSchema > ;
30+ InferInput < typeof configSchema > ;
3131
3232export const plugin : PluginFunction < GraphQLKotlinCodegenConfig > = (
3333 schema ,
@@ -40,14 +40,7 @@ export const plugin: PluginFunction<GraphQLKotlinCodegenConfig> = (
4040 }
4141 const { issues } = safeParse ( configSchema , config ) ;
4242 if ( issues ) {
43- throw new Error (
44- issues
45- . map (
46- ( issue ) =>
47- `${ issue . path ?. [ 0 ] ?. key } must be ${ issue . expected } (${ issue . input } was provided)` ,
48- )
49- . join ( "\n" ) ,
50- ) ;
43+ throw new Error ( issues . map ( ( issue ) => issue . message ) . join ( "\n" ) ) ;
5144 }
5245
5346 const configWithDefaults = buildConfigWithDefaults ( config , info . outputFile ) ;
Original file line number Diff line number Diff line change @@ -3,5 +3,5 @@ import { GraphQLKotlinCodegenConfig } from "../../../src/plugin";
33export default {
44 // @ts -expect-error - invalid config
55 onlyTypes : 2 ,
6- expectedErrorMessage : "onlyTypes must be Array (2 was provided) " ,
6+ expectedErrorMessage : "Invalid type: Expected Array but received 2 " ,
77} satisfies GraphQLKotlinCodegenConfig ;
You can’t perform that action at this time.
0 commit comments