//private static object SwaggerProperty(JsonDataType type, string odataTypeName) private static object SwaggerProperty(ParameterDefinition property) { ParameterDataType type = property.Type; string description = property.Description; return MakeSwaggerProperty(type, description); }
/// <summary> /// Merge values from the param object into this object. /// </summary> /// <param name="param"></param> internal void AddMissingDetails(ParameterDefinition param) { if (!this.Required.HasValue && param.Required.HasValue) this.Required = param.Required; this.IsNavigatable = this.IsNavigatable | param.IsNavigatable; if (this.Type != param.Type) { if (this.Type.IsObject) { if (this.Type.CustomTypeName == null && param.Type.CustomTypeName != null) { this.Type = param.Type; } } else if (this.Type.IsCollection) { if (this.Type.CollectionResourceType == SimpleDataType.Object && this.Type.CustomTypeName == null && param.Type.CollectionResourceType == SimpleDataType.Object && param.Type.CustomTypeName != null) { this.Type = param.Type; } } else if (this.Type.IsLessSpecificThan(param.Type)) { // TODO: This should probably be logged out as documentation warnings! System.Diagnostics.Debug.WriteLine( "Parameter '{2}' type changed, {0} --> {1}", this.Type.Type, param.Type.Type, param.Name); this.Type = param.Type; } } if (string.IsNullOrEmpty(this.Title)) this.Title = param.Title; if (string.IsNullOrEmpty(this.Description)) this.Description = param.Description; if (param.EnumeratedValues != null) this.EnumeratedValues.AddRange(param.EnumeratedValues); }