import { ThingSchema } from "../ThingSchema"; export = OcfSchemaReader; /** * Reads thing schema specifications in OCF RAML+JSON format. */ declare class OcfSchemaReader { /** * Reads a thing schema from an OCF RAML file and supporting JSON files. * * @param {string} filePath Path to the source RAML file * @returns {Promise} Schema parsed from the RAML and JSON files */ static readThingSchemaFromFilesAsync(ramlFilePath: string): Promise; /** * Reads a thing schema from an OCF RAML string and supporting JSON schema strings. * * @param {string} raml RAML contents * @param {{[fileName: string]: string}} json Map from JSON file names to JSON contents * @returns {ThingSchema} Schema parsed from the RAML and JSON strings */ static readThingSchema(raml: string, json: { [fileName: string]: string; }): ThingSchema; /** * Convert a parsed RAML API to a thing schema. * * Note this code (mostly) supports RAML v0.8 and v1.0 APIs. * (OCF currently uses 0.8, so RAML 1.0 support is untested at this point.) */ private static ramlToThingSchema(ramlSchema); /** * Get the JSON schema for a RAML resource method's request body. */ private static getResourceMethodRequestSchema(ramlSchemas, resourceName, ramlResourceMethod); /** * Get the JSON schema for a RAML resource method's response body. * The RAML may define different schemas for different response status codes; * for now we're only looking for a success (200) response code. */ private static getResourceMethodResponseSchema(ramlSchemas, resourceName, ramlResourceMethod, responseCode?); /** * Given a schema name, look it up in the RAML's global schema declarations, * and parse the string as JSON. */ private static getJsonSchema(ramlSchemas, schemaName); private static markdownToString(markdownString); private static capitalize(propertyName); /** * Look for a referenced JSON schema file in the same directory as the RAML file or * in a sibling directory having the same base name as the file. Used with * JsonSchema.resolveReferencesAsync(). */ private static resolveSchemaReferenceAsync(ramlDirectory, resolveCache, fileUri); }