MCPcopy Create free account
hub / github.com/triggerdotdev/jsonhero-web / JsonSchemaProvider

Function JsonSchemaProvider

app/hooks/useJsonSchema.tsx:9–22  ·  view source on GitHub ↗
({ children }: { children: ReactNode })

Source from the content-addressed store, hash-verified

7const JsonSchemaContext = createContext<Schema | undefined>(undefined);
8
9export function JsonSchemaProvider({ children }: { children: ReactNode }) {
10 const [json] = useJson();
11
12 const jsonSchema = useMemo(
13 () => inferSchema(json).toJSONSchema({ includeSchema: true }),
14 [json]
15 );
16
17 return (
18 <JsonSchemaContext.Provider value={jsonSchema}>
19 {children}
20 </JsonSchemaContext.Provider>
21 );
22}
23
24export function useJsonSchema(): Schema {
25 const context = useContext(JsonSchemaContext);

Callers

nothing calls this directly

Calls 1

useJsonFunction · 0.90

Tested by

no test coverage detected