Skip to content

Commit

Permalink
update all examples and all docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Mar 7, 2021
1 parent 79d83ce commit 191e0ca
Show file tree
Hide file tree
Showing 28 changed files with 871 additions and 367 deletions.
3 changes: 3 additions & 0 deletions packages/plugins/typescript/generic-sdk/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';

/**
* This plugin generate a generic SDK (without any Requester implemented), allow you to easily customize the way you fetch your data, without loosing the strongly-typed integration.
*/
export interface RawGenericSdkPluginConfig extends RawClientSideBasePluginConfig {
/**
* usingObservableFrom: "import Observable from 'zen-observable';"
Expand Down
5 changes: 5 additions & 0 deletions packages/utils/config-schema/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export const pluginsConfigurations: PluginConfig[] = [
identifier: 'ReactQueryRawPluginConfig',
name: 'typescript-react-query',
},
{
file: '../../plugins/typescript/generic-sdk/src/config.ts',
identifier: 'RawGenericSdkPluginConfig',
name: 'typescript-generic-sdk',
},
{
file: '../../plugins/typescript/apollo-client-helpers/src/config.ts',
identifier: 'ApolloClientHelpersConfig',
Expand Down
2 changes: 1 addition & 1 deletion website/docs/generated-config/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ Allow you to choose where to add the content.

type: `Types.RequireExtension`

The actual content you wish to add, either a string or array of strings.
The actual content you wish to add, either a string or array of strings.
You can also specify a path to a local file and the content if it will be loaded by codegen.
2 changes: 2 additions & 0 deletions website/docs/generated-config/c-sharp-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ Declares how DocumentNode are created:
- `documentNodeImportFragments`: Similar to documentNode except it imports external fragments instead of embedding them.
- `external`: document nodes are imported from an external file. To be used with `importDocumentNodeExternallyFrom`

Note that some plugins (like `typescript-graphql-request`) also supports `string` for this parameter.


### `optimizeDocumentNode`

Expand Down
52 changes: 26 additions & 26 deletions website/docs/generated-config/flow-operations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This plugin generates Flow types based on your `GraphQLSchema` and your GraphQL operations and fragments.

It generates types for your GraphQL documents: Query, Mutation, Subscription and Fragment.

This plugin generates Flow types based on your `GraphQLSchema` and your GraphQL operations and fragments.

It generates types for your GraphQL documents: Query, Mutation, Subscription and Fragment.

This plugin requires you to use `@graphql-codegen/flow` as well, because it depends on it's types.

## Installation
Expand All @@ -27,13 +27,13 @@ Generates Flow types as Exact types.

#### Usage Examples

```yml
generates:
path/to/file.ts:
plugins:
- flow
config:
useFlowExactObjects: false
```yml
generates:
path/to/file.ts:
plugins:
- flow
config:
useFlowExactObjects: false
```
### `useFlowReadOnlyTypes`
Expand All @@ -45,13 +45,13 @@ Generates read-only Flow types

#### Usage Examples

```yml
generates:
path/to/file.ts:
plugins:
- flow
config:
useFlowReadOnlyTypes: true
```yml
generates:
path/to/file.ts:
plugins:
- flow
config:
useFlowReadOnlyTypes: true
```

### `flattenGeneratedTypes`
Expand All @@ -63,14 +63,14 @@ Flatten fragment spread and inline fragments into a simple selection set before

#### Usage Examples

```yml
generates:
path/to/file.ts:
plugins:
- typescript
- typescript-operations
config:
flattenGeneratedTypes: true
```yml
generates:
path/to/file.ts:
plugins:
- typescript
- typescript-operations
config:
flattenGeneratedTypes: true
```

### `preResolveTypes`
Expand Down
8 changes: 8 additions & 0 deletions website/docs/generated-config/flow-resolvers.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,14 @@ Defines the prefix value used for `__resolveType` and and `__isTypeOf` resolvers
If you are using `mercurius-js`, please set this field to empty string for better compatiblity.


### `onlyResolveTypeForInterfaces`

type: `boolean`
default: `false`

Turning this flag to `true` will generate resolver siganture that has only `resolveType` for interfaces, forcing developers to write inherited type resolvers in the type itself.


### `scalars`

type: `ScalarsMap`
Expand Down
32 changes: 16 additions & 16 deletions website/docs/generated-config/flow.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This plugin generates Flow types based on your `GraphQLSchema`.

This plugin generates Flow types based on your `GraphQLSchema`.

It generates types for your entire schema: types, input types, enum, interface, scalar and union.

## Installation
Expand All @@ -25,13 +25,13 @@ Generates Flow types as Exact types.

#### Usage Examples

```yml
generates:
path/to/file.ts:
plugins:
- flow
config:
useFlowExactObjects: false
```yml
generates:
path/to/file.ts:
plugins:
- flow
config:
useFlowExactObjects: false
```
### `useFlowReadOnlyTypes`
Expand All @@ -43,13 +43,13 @@ Generates read-only Flow types

#### Usage Examples

```yml
generates:
path/to/file.ts:
plugins:
- flow
config:
useFlowReadOnlyTypes: true
```yml
generates:
path/to/file.ts:
plugins:
- flow
config:
useFlowReadOnlyTypes: true
```

### `addUnderscoreToArgsType`
Expand Down
48 changes: 24 additions & 24 deletions website/docs/generated-config/java-apollo-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Customize the Java package name for the generated operations. The default packag

#### Usage Examples

```yml
generates:
./app/src/main/java/:
preset: java-apollo-android
config:
package: "com.my.package.generated.graphql"
plugins:
- java-apollo-android
```yml
generates:
./app/src/main/java/:
preset: java-apollo-android
config:
package: "com.my.package.generated.graphql"
plugins:
- java-apollo-android
```
### `typePackage`
Expand All @@ -40,14 +40,14 @@ Customize the Java package name for the types generated based on input types.

#### Usage Examples

```yml
generates:
./app/src/main/java/:
preset: java-apollo-android
config:
typePackage: "com.my.package.generated.graphql"
plugins:
- java-apollo-android
```yml
generates:
./app/src/main/java/:
preset: java-apollo-android
config:
typePackage: "com.my.package.generated.graphql"
plugins:
- java-apollo-android
```

### `fragmentPackage`
Expand All @@ -58,14 +58,14 @@ Customize the Java package name for the fragments generated classes.

#### Usage Examples

```yml
generates:
./app/src/main/java/:
preset: java-apollo-android
config:
fragmentPackage: "com.my.package.generated.graphql"
plugins:
- java-apollo-android
```yml
generates:
./app/src/main/java/:
preset: java-apollo-android
config:
fragmentPackage: "com.my.package.generated.graphql"
plugins:
- java-apollo-android
```

### `fileType`
Expand Down
80 changes: 40 additions & 40 deletions website/docs/generated-config/java-resolvers.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,53 +20,53 @@ Customize the Java package name. The default package name will be generated acco

#### Usage Examples

```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
package: custom.package.name
```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
package: custom.package.name
```
### `mappers`

type: `object`

Allow you to replace specific GraphQL types with your custom model classes. This is useful when you want to make sure your resolvers returns the correct class.
The default value is the values set by `defaultMapper` configuration.
Allow you to replace specific GraphQL types with your custom model classes. This is useful when you want to make sure your resolvers returns the correct class.
The default value is the values set by `defaultMapper` configuration.
You can use a direct path to the package, or use `package#class` syntax to have it imported.

#### Usage Examples

```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
mappers:
User: com.app.models#UserObject
```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
mappers:
User: com.app.models#UserObject
```

### `defaultMapper`

type: `string`
default: `Object`

Sets the default mapper value in case it's not specified by `mappers`.
You can use a direct path to the package, or use `package#class` syntax to have it imported.
Sets the default mapper value in case it's not specified by `mappers`.
You can use a direct path to the package, or use `package#class` syntax to have it imported.
The default mapper is Java's `Object`.

#### Usage Examples

```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
defaultMapper: my.app.models.BaseEntity
```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
defaultMapper: my.app.models.BaseEntity
```

### `className`
Expand All @@ -78,13 +78,13 @@ Allow you to customize the parent class name.

#### Usage Examples

```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
className: MyResolvers
```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
className: MyResolvers
```

### `listType`
Expand All @@ -96,13 +96,13 @@ Allow you to customize the list type.

#### Usage Examples

```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
listType: Map
```yml
generates:
src/main/java/my-org/my-app/Resolvers.java:
plugins:
- java-resolvers
config:
listType: Map
```

### `scalars`
Expand Down
Loading

0 comments on commit 191e0ca

Please sign in to comment.