internal PropertyModel(JsonProperty property, CSharpTypeResolver resolver, CSharpGeneratorSettings settings) : base(property) { Name = property.Name; HasDescription = !string.IsNullOrEmpty(property.Description); Description = ConversionUtilities.RemoveLineBreaks(property.Description); PropertyName = ConversionUtilities.ConvertToUpperCamelCase(property.Name); FieldName = ConversionUtilities.ConvertToLowerCamelCase(property.Name); Required = property.IsRequired && settings.RequiredPropertiesMustBeDefined ? "Required.Always" : "Required.Default"; IsStringEnum = property.ActualPropertySchema.IsEnumeration && property.ActualPropertySchema.Type == JsonObjectType.String; Type = resolver.Resolve(property.ActualPropertySchema, property.IsNullable, property.Name); }
private static string GenerateInheritanceCode(CSharpGeneratorSettings settings, CSharpTypeResolver resolver, JsonSchema4 schema, bool hasInheritance) { if (hasInheritance) { return(": " + resolver.Resolve(schema.AllOf.First(), false, string.Empty) + (settings.ClassStyle == CSharpClassStyle.Inpc ? ", INotifyPropertyChanged" : "")); } else { return(settings.ClassStyle == CSharpClassStyle.Inpc ? ": INotifyPropertyChanged" : ""); } }