Skip to content

Commit 8390d20

Browse files
committed
chore(ns-imports): fix README + config desc
1 parent 43033d9 commit 8390d20

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,34 @@ import { GeneratedInput } from './graphql'
8787
/* generates validation schema here */
8888
```
8989

90+
### `schemaNamespacedImportName`
91+
92+
type: `string`
93+
94+
If defined, will use named imports from the specified module (defined in `importFrom`) rather than individual imports for each type.
95+
96+
```yml
97+
generates:
98+
path/to/types.ts:
99+
plugins:
100+
- typescript
101+
path/to/schemas.ts:
102+
plugins:
103+
- graphql-codegen-validation-schema
104+
config:
105+
schema: yup
106+
importFrom: ./path/to/types
107+
schemaNamespacedImportName: types
108+
```
109+
110+
Then the generator generates code with import statement like below.
111+
112+
```ts
113+
import * as types from './graphql'
114+
115+
/* generates validation schema here */
116+
```
117+
90118
### `useTypeImports`
91119

92120
type: `boolean` default: `false`

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export interface ValidationSchemaPluginConfig extends TypeScriptPluginConfig {
7070
* config:
7171
* schema: yup
7272
* importFrom: ./path/to/types
73-
* namespacedImportName: types
73+
* schemaNamespacedImportName: types
7474
* ```
7575
*/
7676
schemaNamespacedImportName?: string

0 commit comments

Comments
 (0)