private void SetClassesProperties(ClassObject rootClassObject) { var propertiesNames = new List <string>(); foreach (var parentResource in raml.Resources) { var fullUrl = GetUrl(null, parentResource.RelativeUri); if (!parentResource.RelativeUri.StartsWith("/{") || !parentResource.RelativeUri.EndsWith("}")) { var property = new FluentProperty { Name = GetExistingObjectName(fullUrl), }; if (propertiesNames.Contains(property.Name)) { continue; } rootClassObject.Properties.Add(property); propertiesNames.Add(property.Name); var classObj = GetClassObject(fullUrl); if (classObj == null) { throw new InvalidOperationException("Null class object for resource " + fullUrl); } SetFluentApiProperties(parentResource, classObj, fullUrl); } else { SetFluentApiProperties(parentResource, rootClassObject, fullUrl); } SetClassesProperties(parentResource.Resources, rootClassObject, fullUrl); } }
private void SetFluentApiProperties(Resource resource, ClassObject classObject, string url) { var propertiesNames = new List<string>(); foreach (var childResource in resource.Resources) { if (childResource.RelativeUri.StartsWith("/{") && childResource.RelativeUri.EndsWith("}")) continue; var property = new FluentProperty { Name = GetExistingObjectName(GetUrl(url, childResource.RelativeUri)), }; if (propertiesNames.Contains(property.Name)) continue; classObject.Properties.Add(property); propertiesNames.Add(property.Name); } }
private void SetClassesProperties(ClassObject rootClassObject) { var propertiesNames = new List<string>(); foreach (var parentResource in raml.Resources) { var fullUrl = GetUrl(null, parentResource.RelativeUri); if (!parentResource.RelativeUri.StartsWith("/{") || !parentResource.RelativeUri.EndsWith("}")) { var property = new FluentProperty { Name = GetExistingObjectName(fullUrl), }; if (propertiesNames.Contains(property.Name)) continue; rootClassObject.Properties.Add(property); propertiesNames.Add(property.Name); var classObj = GetClassObject(fullUrl); if (classObj == null) throw new InvalidOperationException("Null class object for resource " + fullUrl); SetFluentApiProperties(parentResource, classObj, fullUrl); SetClassesProperties(parentResource.Resources, classObj, fullUrl); } else { SetFluentApiProperties(parentResource, rootClassObject, fullUrl); SetClassesProperties(parentResource.Resources, rootClassObject, fullUrl); } } }