private JsonSchemaLink ProcessLink(JObject schemaObject)
        {
            JsonSchemaLink currentLink = new JsonSchemaLink();

            foreach (KeyValuePair <string, JToken> property in schemaObject)
            {
                switch (property.Key)
                {
                case JsonSchemaConstants.HrefPropertyName:
                    currentLink.Href = (string)property.Value;
                    break;

                case JsonSchemaConstants.RelationPropertyName:
                    currentLink.Relation = (string)property.Value;
                    break;

                case JsonSchemaConstants.TitlePropertyName:
                    currentLink.Title = (string)property.Value;
                    break;

                case JsonSchemaConstants.TargetSchemaPropertyName:
                    currentLink.TargetSchema = BuildSchema(property.Value);
                    break;

                case JsonSchemaConstants.MediaTypePropertyName:
                    currentLink.MediaType = (string)property.Value;
                    break;

                case JsonSchemaConstants.MethodPropertyName:
                    currentLink.Method = (string)property.Value;
                    break;

                case JsonSchemaConstants.EncodingTypePropertyName:
                    currentLink.EncodingType = (string)property.Value;
                    break;

                case JsonSchemaConstants.SchemaPropertyName:
                    currentLink.Schema = BuildSchema(property.Value);
                    break;
                }
            }

            if (string.IsNullOrEmpty(currentLink.Href))
            {
                throw JsonException.Create(schemaObject, schemaObject.Path, "Missing required link property: href");
            }

            if (string.IsNullOrEmpty(currentLink.Relation))
            {
                throw JsonException.Create(schemaObject, schemaObject.Path, "Missing required link property: rel");
            }

            return(currentLink);
        }
        private JsonSchemaLink ProcessLink(JObject schemaObject)
        {
            JsonSchemaLink currentLink = new JsonSchemaLink();

            foreach (KeyValuePair<string, JToken> property in schemaObject)
            {
                switch (property.Key)
                {
                    case JsonSchemaConstants.HrefPropertyName:
                        currentLink.Href = (string)property.Value;
                        break;
                    case JsonSchemaConstants.RelationPropertyName:
                        currentLink.Relation = (string)property.Value;
                        break;
                    case JsonSchemaConstants.TitlePropertyName:
                        currentLink.Title = (string)property.Value;
                        break;
                    case JsonSchemaConstants.TargetSchemaPropertyName:
                        currentLink.TargetSchema = BuildSchema(property.Value);
                        break;
                    case JsonSchemaConstants.MediaTypePropertyName:
                        currentLink.MediaType = (string)property.Value;
                        break;
                    case JsonSchemaConstants.MethodPropertyName:
                        currentLink.Method = (string)property.Value;
                        break;
                    case JsonSchemaConstants.EncodingTypePropertyName:
                        currentLink.EncodingType = (string)property.Value;
                        break;
                    case JsonSchemaConstants.SchemaPropertyName:
                        currentLink.Schema = BuildSchema(property.Value);
                        break;
                }
            }

            if (string.IsNullOrEmpty(currentLink.Href))
                throw JsonException.Create(schemaObject, schemaObject.Path, "Missing required link property: href");

            if (string.IsNullOrEmpty(currentLink.Relation))
                throw JsonException.Create(schemaObject, schemaObject.Path, "Missing required link property: rel");

            return currentLink;
        }