Skip to main content

The Repository Provider

The Repository Provider provides AutoView with The Component Repository and the AJV schema validator.

The AutoView component requires a repository provider to function.

Note that repository providers can be nested, allowing the usage of one at the root level of the application while using nested repository providers for internal object or array components.

Properties of Repository Provider​

NameTypeDefault ValueDescription
componentsComponentsRepoRequired The component repository to use with AutoView.
schemasCoreSchemaMetaSchema[]JSONSchemas to use with the AJV validator.

Example​

import {RepositoryConsumer} from '@autoviews/core';

<RepositoryProvider components={repo}>// ...</RepositoryProvider>;

useRepositoryContext​

React custom hook, to get the repo and validator from the current context.

Example​

import {useRepositoryContext} from '@autoviews/core';

const MyComponent = () => {
const {components, validator} = useRepositoryContext();
// ...
};