Esempio n. 1
0
        public void CreateSwaggerDefinitionForStructureType_ReturnsSwaggerObject()
        {
            // Arrange & Act
            JObject obj = ODataSwaggerUtilities.CreateSwaggerDefinitionForStructureType(_customer);

            // Assert
            Assert.NotNull(obj);
            Assert.Contains("\"$ref\": \"#/definitions/NS.Address\"", obj.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Initialize the type definitions to Swagger model.
        /// </summary>
        protected virtual void InitializeTypeDefinitions()
        {
            Contract.Assert(SwaggerDoc != null);
            Contract.Assert(EdmModel != null);

            SwaggerDefinitions = new JObject();
            SwaggerDoc.Add("definitions", SwaggerDefinitions);

            foreach (var type in EdmModel.SchemaElements.OfType <IEdmStructuredType>())
            {
                SwaggerDefinitions.Add(type.FullTypeName(),
                                       ODataSwaggerUtilities.CreateSwaggerDefinitionForStructureType(type));
            }
        }