Skip to content

Commit

Permalink
Fixed docs urls.
Browse files Browse the repository at this point in the history
  • Loading branch information
radekmie committed Dec 23, 2021
1 parent 38a7f33 commit 71e3acd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/api-bridges.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ Currently available bridges:
- `SimpleSchema2Bridge` in `uniforms-bridge-simple-schema-2`
- `SimpleSchemaBridge` in `uniforms-bridge-simple-schema`

If you see a lot of [`Warning: Unknown props...`](https://fb.me/react-unknown-prop) logs, check if your schema or theme doesn't provide extra props. If so, consider [registering it with `filterDOMProps`](api-helpers#filterdomprops).
If you see a lot of [`Warning: Unknown props...`](https://fb.me/react-unknown-prop) logs, check if your schema or theme doesn't provide extra props. If so, consider [registering it with `filterDOMProps`](/docs/api-helpers#filterdomprops).

## `GraphQLBridge`

This bridge enables using GraphQL schema types as uniforms forms.
This saves you from not having to rewrite the form schema in your code.
As a trade-off, you have to write the validator from scratch. In some cases, it might be easier to rewrite the schema and use, for example, [`JSONSchemaBridge` with `ajv`](api-bridges#jsonschemabridge).
As a trade-off, you have to write the validator from scratch. In some cases, it might be easier to rewrite the schema and use, for example, [`JSONSchemaBridge` with `ajv`](/docs/api-bridges#jsonschemabridge).
If only a simple or no validation is needed, this bridge is perfectly suited to work with GraphQL schemas.

The constructor accepts three arguments:

- `schema: GraphQLType` can be any type parsed and extracted from a GraphQL schema.
- `validator: (model: Record<string, any>) => any` a custom validator function that should return a falsy value if no errors are present or information about errors in the model as described in the [custom bridge section](examples-custom-bridge#validator-definition).
- `validator: (model: Record<string, any>) => any` a custom validator function that should return a falsy value if no errors are present or information about errors in the model as described in the [custom bridge section](/docs/examples-custom-bridge#validator-definition).
- `extras: Record<string, any> = {}` used to extend the schema generated from GraphQL type with extra field configuration.

### Code example
Expand Down
2 changes: 1 addition & 1 deletion docs/examples-custom-fields.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ field props here, like value or onChange for some extra logic.

### `CustomAutoField`

**Note:** Since v3.1, the preferred way is to create an `AutoField` component is to use the `createAutoField` helper. Also, it's often the case that using the [`AutoField.componentDetectorContext`](uth-autofield-algorithm#overriding-autofield) is enough.
**Note:** Since v3.1, the preferred way is to create an `AutoField` component is to use the `createAutoField` helper. Also, it's often the case that using the [`AutoField.componentDetectorContext`](/docs/uth-autofield-algorithm#overriding-autofield) is enough.

These are two _standard_ options to define a custom `AutoField`: either using `connectField` or simply taking the code from the [original one](https://github.com/vazco/uniforms/blob/master/packages/uniforms-unstyled/src/AutoField.tsx#L14-L47) _(theme doesn't matter)_ and simply apply own components and/or rules to render components. Below an example with `connectField`.

Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ You can style your form fields simply by passing a `className` property.

### How can I create custom fields?

You can create a custom field by wrapping your component inside the [`connectField`](api-helpers#connectfieldcomponent-options).
You can create a custom field by wrapping your component inside the [`connectField`](/docs/api-helpers#connectfieldcomponent-options).

The `connectField` will pass various props related to the form management, such as `onChange()` function, current field's value, errors and so on, to your component.

Expand Down
3 changes: 3 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,7 @@ module.exports = {
},
],
],
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
onDuplicateRoutes: 'throw',
};

0 comments on commit 71e3acd

Please sign in to comment.