Page Contents
Home > @loopback/repository-json-schema
repository-json-schema package
Convert a TypeScript class/model to a JSON Schema for users, leveraging LoopBack4’s decorators, metadata, and reflection system.
Remarks
Modules to easily convert LoopBack4 models that have been decorated with @model and @property to a matching JSON Schema Definition.
Functions
| Function | Description |
|---|---|
| [getFieldsJsonSchemaFor(modelCtor, options)](/doc/en/lb4/apidocs.repository-json-schema.getfieldsjsonschemafor.html) | Build a JSON schema describing the format of the "fields" object used to include or exclude properties of model instances. |
| [getFilterJsonSchemaFor(modelCtor, options)](/doc/en/lb4/apidocs.repository-json-schema.getfilterjsonschemafor.html) | Build a JSON schema describing the format of the "filter" object used to query model instances. Note we don't take the model properties into account yet and return a generic json schema allowing any "where" condition. |
| [getJsonSchema(ctor, options)](/doc/en/lb4/apidocs.repository-json-schema.getjsonschema.html) | Gets the JSON Schema of a TypeScript model/class by seeing if one exists in a cache. If not, one is generated and then cached. |
| [getJsonSchemaRef(modelCtor, options)](/doc/en/lb4/apidocs.repository-json-schema.getjsonschemaref.html) | Describe the provided Model as a reference to a definition shared by multiple endpoints. The definition is included in the returned schema. |
| [getNavigationalPropertyForRelation(relMeta, targetRef)](/doc/en/lb4/apidocs.repository-json-schema.getnavigationalpropertyforrelation.html) | Checks and return navigational property definition for the relation |
| [getScopeFilterJsonSchemaFor(modelCtor, options)](/doc/en/lb4/apidocs.repository-json-schema.getscopefilterjsonschemafor.html) | Build a JSON schema describing the format of the "scope" object used to query model instances. Note we don't take the model properties into account yet and return a generic json schema allowing any "where" condition. |
| [getWhereJsonSchemaFor(modelCtor, options)](/doc/en/lb4/apidocs.repository-json-schema.getwherejsonschemafor.html) | Build a JSON schema describing the format of the "where" object used to filter model instances to query, update or delete. Note we don't take the model properties into account yet and return a generic json schema allowing any "where" condition. |
| [isArrayType(type)](/doc/en/lb4/apidocs.repository-json-schema.isarraytype.html) | Determines whether a given string or constructor is array type or not |
| [metaToJsonProperty(meta)](/doc/en/lb4/apidocs.repository-json-schema.metatojsonproperty.html) | Converts property metadata into a JSON property definition |
| [modelToJsonSchema(ctor, jsonSchemaOptions)](/doc/en/lb4/apidocs.repository-json-schema.modeltojsonschema.html) | Converts a TypeScript class into a JSON Schema using TypeScript's reflection API |
| [stringTypeToWrapper(type)](/doc/en/lb4/apidocs.repository-json-schema.stringtypetowrapper.html) | Gets the wrapper function of primitives string, number, and boolean |
Interfaces
| Interface | Description |
|---|---|
| [FilterSchemaOptions](/doc/en/lb4/apidocs.repository-json-schema.filterschemaoptions.html) | |
| [JsonSchemaOptions](/doc/en/lb4/apidocs.repository-json-schema.jsonschemaoptions.html) |
Variables
| Variable | Description |
|---|---|
| [AnyScopeFilterSchema](/doc/en/lb4/apidocs.repository-json-schema.anyscopefilterschema.html) | |
| [JSON\_SCHEMA\_KEY](/doc/en/lb4/apidocs.repository-json-schema.json_schema_key.html) | Metadata key used to set or retrieve repository JSON Schema |
Type Aliases
| Type Alias | Description |
|---|---|
| [Optional](/doc/en/lb4/apidocs.repository-json-schema.optional.html) | Optional: From `T` make a set of properties by key `K` become optional |