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 23
23
"@graphql-codegen/plugin-helpers" : " 5.0.4" ,
24
24
"@graphql-codegen/visitor-plugin-common" : " 5.2.0" ,
25
25
"ts-deepmerge" : " 7.0.0" ,
26
- "valibot" : " 0.30.0 "
26
+ "valibot" : " 0.31.1 "
27
27
},
28
28
"devDependencies" : {
29
29
"@graphql-codegen/cli" : " 5.0.2" ,
Original file line number Diff line number Diff line change @@ -20,14 +20,14 @@ import {
20
20
ParsedConfig ,
21
21
RawConfig ,
22
22
} from "@graphql-codegen/visitor-plugin-common" ;
23
- import { Input , safeParse } from "valibot" ;
23
+ import { InferInput , safeParse } from "valibot" ;
24
24
import { configSchema } from "./config/schema" ;
25
25
import { buildConfigWithDefaults } from "./config/build-config-with-defaults" ;
26
26
import { addDependentTypesToOnlyTypes } from "./config/add-dependent-types-to-only-types" ;
27
27
import { visit } from "graphql" ;
28
28
29
29
export type GraphQLKotlinCodegenConfig = Partial < RawConfig & ParsedConfig > &
30
- Input < typeof configSchema > ;
30
+ InferInput < typeof configSchema > ;
31
31
32
32
export const plugin : PluginFunction < GraphQLKotlinCodegenConfig > = (
33
33
schema ,
@@ -40,14 +40,7 @@ export const plugin: PluginFunction<GraphQLKotlinCodegenConfig> = (
40
40
}
41
41
const { issues } = safeParse ( configSchema , config ) ;
42
42
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" ) ) ;
51
44
}
52
45
53
46
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";
3
3
export default {
4
4
// @ts -expect-error - invalid config
5
5
onlyTypes : 2 ,
6
- expectedErrorMessage : "onlyTypes must be Array (2 was provided) " ,
6
+ expectedErrorMessage : "Invalid type: Expected Array but received 2 " ,
7
7
} satisfies GraphQLKotlinCodegenConfig ;
You can’t perform that action at this time.
0 commit comments