Beispiel #1
0
        public void SetUp()
        {
            var retriever = new SwaggerRetriever(JsonMetadataTests.ApiMetadataConfiguration);

            var metadataRetriever = new SwaggerMetadataRetriever(
                JsonMetadataTests.ApiMetadataConfiguration, retriever,
                new List <string>());

            var jfactory = new JsonMetadataFactory(metadataRetriever);

            _jsonMetadata = jfactory.GetMetadata().ToList();

            var ssbuilder = new SchemaSetFactory(new XsdStreamsRetriever(JsonMetadataTests.XmlMetadataConfiguration));
            var xfactory  = new XsdMetadataFactory(ssbuilder.GetSchemaSet());

            _xmlMetadata = xfactory.GetMetadata().ToList();

            var strategies = new List <IMetadataMapper>
            {
                //new DiminishingMetadataMapper(),
                new PremappedLookupMetadataMapper(), new LookupDoNotMapPropertyMapper(),

                //new ArrayMetadataMapper(),
                new DescriptorReferenceMetadataMapper(), new NameMatchingMetadataMapper()

                //new SchoolIdBugFixMetadataMapper()
            };

            var factory = new LookupToGetByExampleMetadataMappingFactory(_xmlMetadata, _jsonMetadata, strategies);

            _mappings = factory.GetMetadataMappings().ToArray();
        }
        public void SetUp()
        {
            var retriever = new SwaggerRetriever(JsonMetadataTests.ApiMetadataConfiguration);

            var metadataRetriever = new SwaggerMetadataRetriever(
                JsonMetadataTests.ApiMetadataConfiguration, retriever,
                new List <string>());

            var ssbuilder = new SchemaSetFactory(new XsdStreamsRetriever(JsonMetadataTests.XmlMetadataConfiguration));
            var xfactory  = new XsdApiTypesMetadataFactory(ssbuilder.GetSchemaSet());

            _xmlMetadata = xfactory.GetMetadata().ToList();

            var jfactory = new JsonMetadataFactory(metadataRetriever);

            _jsonMetadata = jfactory.GetMetadata().ToList();

            var strategies = new IMetadataMapper[]
            {
                new ArrayMetadataMapper(), new DescriptorReferenceMetadataMapper(), new NameMatchingMetadataMapper()
            };

            var factory = new ResourceToResourceMetadataMappingFactory(
                _xmlMetadata.AsEnumerable(),
                _jsonMetadata.AsEnumerable(), strategies);

            _mappings = factory.GetMetadataMappings().ToArray();
        }
Beispiel #3
0
        public void Should_display_all_Json_metadata()
        {
            var loader = new SwaggerMetadataRetriever(
                ApiMetadataConfiguration, new SwaggerRetriever(ApiMetadataConfiguration), new List <string>
            {
                "ed-fi"
            });

            IEnumerable <JsonModelMetadata> jsonMetadata = loader.GetMetadata().Result;

            foreach (JsonModelMetadata metadata in jsonMetadata)
            {
                Console.WriteLine(
                    $"{metadata.Model},{metadata.Property},{metadata.Type},{metadata.IsArray},{metadata.IsRequired},{metadata.IsSimpleType}");
            }
        }
 public JsonMetadataFactory(SwaggerMetadataRetriever swaggerMetadata)
 {
     _swaggerMetadata = swaggerMetadata;
 }