private void HandleComplexResourceType(ModelDescription modelDescription, List<ParameterDescription> members)
        {
            var complexTypeResourceDescription = modelDescription as ComplexTypeModelDescription;

            if (complexTypeResourceDescription != null)
                members.AddRange(complexTypeResourceDescription.Properties);
        }
        private KeyValuePair<string, object> GetSampleForModel(ModelDescription modelDescription)
        {
            var simpleTypeResourceDescription = ResourceDescription as SimpleTypeModelDescription;

            if (simpleTypeResourceDescription != null)
                return new KeyValuePair<string, object>("Text", new ObjectGenerator().GenerateObject(modelDescription.ModelType));
           
            var json = JsonConvert.SerializeObject(new ObjectGenerator().GenerateObject(modelDescription.ModelType), Formatting.Indented);
            return new KeyValuePair<string, object>("json", json);
        }
示例#3
0
        private static IList<ParameterDescription> GetParameterDescriptions(ModelDescription modelDescription)
        {
            ComplexTypeModelDescription complexTypeModelDescription = modelDescription as ComplexTypeModelDescription;
            if (complexTypeModelDescription != null)
            {
                return complexTypeModelDescription.Properties;
            }

            CollectionModelDescription collectionModelDescription = modelDescription as CollectionModelDescription;
            if (collectionModelDescription != null)
            {
                complexTypeModelDescription = collectionModelDescription.ElementDescription as ComplexTypeModelDescription;
                if (complexTypeModelDescription != null)
                {
                    return complexTypeModelDescription.Properties;
                }
            }

            return null;
        }
        private static ParameterDescription AddParameterDescription(HelpPageApiModel apiModel,
            ApiParameterDescription apiParameter, ModelDescription typeDescription)
        {
            ParameterDescription parameterDescription = new ParameterDescription
            {
                Name = apiParameter.Name,
                Documentation = apiParameter.Documentation,
                TypeDescription = typeDescription,
            };

            apiModel.UriParameters.Add(parameterDescription);
            return parameterDescription;
        }
 public ResourceModelDescription(ModelDescription modelDescription, List<ParameterDescription> members)
 {
     ModelDescription = modelDescription;
     Members = members;
 }