diff --git a/node_modules/@loopback/repository-json-schema/dist/build-schema.js b/node_modules/@loopback/repository-json-schema/dist/build-schema.js
index e148019..eeb0b8b 100644
--- a/node_modules/@loopback/repository-json-schema/dist/build-schema.js
+++ b/node_modules/@loopback/repository-json-schema/dist/build-schema.js
@@ -163,6 +163,25 @@ function metaToJsonProperty(meta) {
     const propDef = {};
     let result;
     let propertyType = meta.type;
+    if (meta.length !== undefined) {
+        propDef['x-length'] = meta.length;
+    }
+    if (meta.precision !== undefined) {
+        propDef['x-precision'] = meta.precision;
+    }
+    if (meta.scale !== undefined) {
+        propDef['x-scale'] = meta.scale;
+    }
+    if (meta.generated !== undefined) {
+        propDef['x-generated'] = meta.generated;
+    }
+    if (meta.hidden !== undefined) {
+        propDef['x-hidden'] = meta.hidden;
+    }
+    if (meta.index !== undefined) {
+        propDef['x-index'] = meta.index;
+    }
+    propDef['x-primary-key'] = meta.id ? true: false;
     if (isArrayType(propertyType) && meta.itemType) {
         if (isArrayType(meta.itemType) && !meta.jsonSchema) {
             throw new Error('You must provide the "jsonSchema" field when define ' +
@@ -362,6 +381,7 @@ function modelToJsonSchema(ctor, jsonSchemaOptions = {}) {
         result.properties[p] = result.properties[p] || {};
         const metaProperty = Object.assign({}, meta.properties[p]);
         // populating "properties" key
+        
         result.properties[p] = metaToJsonProperty(metaProperty);
         // handling 'required' metadata
         const optional = options.optional.includes(p);
@@ -429,15 +449,105 @@ function modelToJsonSchema(ctor, jsonSchemaOptions = {}) {
             const targetSchema = getJsonSchema(targetType, targetOptions);
             const targetRef = { $ref: `#/definitions/${targetSchema.title}` };
             const propDef = getNavigationalPropertyForRelation(relMeta, targetRef);
-            result.properties[relMeta.name] =
-                result.properties[relMeta.name] || propDef;
-            if (relMeta.keyFrom) {
-                result.properties.foreignKey = relMeta
-                    .keyFrom;
+            result.properties[relMeta.name] = result.properties[relMeta.name] || propDef;
+            const foreignKey = {};
+            let relationships = {};
+            relationships = {};
+            if (!relationships[relMeta.name]) {
+                relationships[relMeta.name] = {};
+            }
+            if (relMeta.type === 'belongsTo') {
+                let keyFrom = relMeta.keyFrom;
+                if (!keyFrom) {
+                    keyFrom = targetType.name.toLowerCase() + 'Id';
+                }
+                foreignKey[keyFrom] = targetType.name;
+                relationships[relMeta.name].description = `\${relMeta.source.name} belongs to \${targetType.name}.`;
+                relationships[relMeta.name].type = 'object';
+                relationships[relMeta.name].$ref = `#/definitions/\${targetSchema.title}`;
+            }
+            if (relMeta.type === 'hasMany') {
+                if (relMeta.through) {
+                    relationships = {};
+                    if (!relationships[relMeta.name]) {
+                        relationships[relMeta.name] = {};
+                    }
+                    let keyTo = relMeta.through.keyTo;
+                    let keyFrom = relMeta.through.keyFrom;
+                    if (!keyTo) {
+                        keyTo = targetType.name.toLowerCase() + 'Id';
+                    }
+                    if (!keyFrom) {
+                        keyFrom = relMeta.source.name.toLowerCase() + 'Id';
+                    }
+                    foreignKey[keyTo] = targetType.name;
+                    foreignKey[keyFrom] = relMeta.source.name;
+                    relationships[relMeta.name].description = `\${relMeta.source.name} have many \${targetType.name}.`;
+                    relationships[relMeta.name].type = 'object';
+                    relationships[relMeta.name].$ref = `#/definitions/\${targetSchema.title}`;
+                } else {
+                    let keyFrom = relMeta.keyFrom;
+                    if (!keyFrom) {
+                        keyFrom = relMeta.source.name.toLowerCase() + 'Id';
+                    }
+                    foreignKey[keyFrom] = relMeta.source.name;
+                    relationships[relMeta.name].description = `\${relMeta.source.name} have many \${targetType.name}.`;
+                    relationships[relMeta.name].type = 'array';
+                    relationships[relMeta.name].items = { $ref: `#/definitions/\${targetSchema.title}`};
+                }
+            }
+            if (relMeta.type === 'hasOne') {
+                relationships = {};
+                if (!relationships[relMeta.name]) {
+                    relationships[relMeta.name] = {};
+                }
+                let keyTo = relMeta.keyTo;
+                if (!keyTo) {
+                    keyTo = relMeta.source.name.toLowerCase() + 'Id';
+                }
+                foreignKey[keyTo] = relMeta.source.name;
+                relationships[relMeta.name].description = `\${relMeta.source.name} have one \${targetType.name}.`;
+                relationships[relMeta.name].type = 'object';
+                relationships[relMeta.name].$ref = `#/definitions/\${targetSchema.title}`;
+            }
+            if (relMeta.type === 'referencesMany') {
+                let keyFrom = relMeta.keyFrom;
+                if (!keyFrom) {
+                    keyFrom = targetType.name.toLowerCase() + 'Ids';
+                }
+                foreignKey[keyFrom] = targetType.name;
+                relationships[relMeta.name].description = `\${relMeta.source.name} references many \${targetType.name}.`;
+                relationships[relMeta.name].type = 'array';
+                relationships[relMeta.name].items = { $ref: `#/definitions/\${targetSchema.title}` };
+            }
+            relationships[relMeta.name].foreignKeys = foreignKey;
+            relationships[relMeta.name].sourceModel = relMeta.source.name;
+            relationships[relMeta.name].targetModel = targetType.name;
+            relationships[relMeta.name].includeRelations = targetOptions.includeRelations;
+            relationships[relMeta.name]['x-relation-type'] = relMeta.type;
+            if (relMeta.through) {
+                const throughModel = relMeta.through.model();
+                relationships[relMeta.name].through = throughModel.definition.name;
+            }
+            if (result.description) {
+                if (result.description.includes('relationships')) {
+                    const relationMatched = result.description.match(/\{\"relationships\".*\$/s);
+                    if (relationMatched) {
+                        const { relationships: existingRelation } = JSON.parse(relationMatched[0]);
+                        existingRelation[Object.keys(relationships)[0]] = { ...relationships };
+                        result.description = result.description.replace(/\{\"relationships\".*\$/s, '');
+                        result.description = result.description + `, \${JSON.stringify({ relationships: existingRelation })}`;
+                    }
+                } else {
+                    result.description = result.description + `, \${JSON.stringify({ relationships })}`;
+                }
             }
             includeReferencedSchema(targetSchema.title, targetSchema);
         }
     }
+    if (meta.settings && meta.settings.indexes) {
+        result['x-indexes'] = meta.settings.indexes;
+    }
     function includeReferencedSchema(name, schema) {
         var _a, _b;
         if (!schema || !Object.keys(schema).length)
