Skip to content

routier-collection


routier-collection / core/src / rehydrateSchemaFromJsonString

Function: rehydrateSchemaFromJsonString() ​

rehydrateSchemaFromJsonString(jsonString, collectionName?): SchemaDefinition<any>

Defined in: core/src/schema/utils/standardJsonSchema.ts:553

Parses a JSON string containing a JSON Schema and rehydrates it into a Routier SchemaDefinition. This is a convenience wrapper around rehydrateSchemaFromJsonSchema that handles JSON parsing.

Parameters ​

jsonString ​

string

The JSON string containing the JSON Schema

collectionName? ​

string

The collection name for the schema (if not in x-routier metadata)

Returns ​

SchemaDefinition<any>

A SchemaDefinition that can be compiled

Throws ​

Error if the JSON string is invalid or doesn't contain a valid JSON Schema

Released under the MIT License.