internal void SetInnerClass(ClassFactory factory, List <BaseOutputClass> list, DocumentSchema schema) { if (IsDictionary) { var @ref = schema.AdditionalProperties.Ref; var innerEntity = @ref != null? list.First(p => p.ReferenceName == @ref) : factory.CreateDefinitionWithDeep(schema.AdditionalProperties, list); InnerClass = innerEntity; return; } if (Type == ClassTypeEnum.Array) { string @ref = null; if (schema.Items != null) { @ref = schema.Items.Ref; } else if (schema.AllOf != null) { @ref = schema.AllOf.Ref; } var innerEntity = @ref != null? list.First(p => p.ReferenceName == @ref) : factory.CreateDefinitionWithDeep(schema.Items, list); InnerClass = innerEntity; } }
public void SetProperties(ClassFactory factory, List <BaseOutputClass> list, DocumentSchema schema) { if (schema.Properties != null && schema.Properties.Count > 0) { Properties = new List <ClassProperty>(); foreach (var property in schema.Properties) { var propertyValue = property.Value; var @ref = propertyValue.Ref ?? propertyValue.AllOf?.Ref; var innerEntity = @ref != null? list.First(p => p.ReferenceName == @ref) : factory.CreateDefinitionWithDeep(property.Value, list); Properties.Add(new ClassProperty() { IsNullable = !schema.Required.Contains(property.Key), Name = property.Key, Class = innerEntity }); } } }