synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
41 lines • 2.48 kB
TypeScript
/**
* Utilities for retrieving annotation fields (e.g. "title", "description") from JSON Schemas
*/
import * as AnnotatedInstance from '@hyperjump/json-schema/annotated-instance/experimental';
import { JsonNode } from '@hyperjump/json-schema/instance/experimental';
import { Json } from '@sage-bionetworks/synapse-client';
import { JSONSchema7 } from 'json-schema';
/**
* Get the value of a specified annotation for a specified key described in the JsonNode
* @param key - the property key for which the description should be retrieved.
* @param instance - a JsonNode resolved by the `annotate` API provided by @hyperjump/json-schema/annotations/experimental
* @param annotationKey - the value that corresponds to the annotation to retrieve, e.g. "title", "description"
*/
export declare function getSchemaAnnotationForProperty(key: string, instance: JsonNode, annotationKey: string): string | undefined;
/**
* Get the "title" for a specific key described in the JsonNode
* @param key - the property key for which the description should be retrieved.
* @param instance - a JsonNode resolved by the `annotate` API provided by @hyperjump/json-schema/annotations/experimental
*/
export declare function getDisplayedAnnotationTitle(key: string, instance?: JsonNode | null): string;
/**
* Get the "description" for a specific key described in the JsonNode
* @param key - the property key for which the description should be retrieved.
* @param instance - a JsonNode resolved by the `annotate` API provided by @hyperjump/json-schema/annotations/experimental
*/
export declare function getDisplayedAnnotationDescription(key: string, instance?: JsonNode | null): string | undefined;
/**
* Registers a schema with @hyperjump/json-schema.
* @param schema
* @return boolean indicating if the schema is registered.
*/
export declare function useRegisterSchema(schema?: JSONSchema7): boolean;
/**
* Given a JSON document and a schema that describes it, return a query result that
* resolves a JsonNode that can be used to retrieve schema annotations. Uses the `annotate` API provided
* by @hyperjump/json-schema/annotations/experimental
* @param json - a JSON document
* @param schema - a JSON Schema that describes the JSON document
*/
export declare function useGetAnnotatedJsonInstance(json?: Json, schema?: JSONSchema7): import("@tanstack/react-query").UseQueryResult<AnnotatedInstance.JsonNode | null, Error>;
//# sourceMappingURL=SchemaAnnotationUtils.d.ts.map