예제 #1
0
        public void CreateSwaggerDefinitionForStructureType_ReturnsSwaggerObject()
        {
            // Arrange & Act
            JObject obj = ODataSwaggerUtilities.CreateSwaggerTypeDefinitionForStructuredType(_customer);

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

            SwaggerTypeDefinitions = new JObject();
            SwaggerDocument.Add("definitions", SwaggerTypeDefinitions);

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