Пример #1
0
        public override async Task Generate(ServiceClient serviceClient)
        {
            IDictionary <string, ResourceSchema> resourceSchemas = ResourceSchemaParser.Parse(serviceClient);

            foreach (string resourceProvider in resourceSchemas.Keys)
            {
                StringWriter stringWriter = new StringWriter();
                ResourceSchemaWriter.Write(stringWriter, resourceSchemas[resourceProvider]);

                string schemaPath = Path.Combine(Settings.OutputDirectory, resourceProvider + ".json");
                await Write(stringWriter.ToString(), schemaPath);
            }
        }
Пример #2
0
        public override async Task Generate(CodeModel serviceClient)
        {
            IDictionary <string, ResourceSchema> resourceSchemas = ResourceSchemaParser.Parse(serviceClient);

            foreach (string resourceProvider in resourceSchemas.Keys)
            {
                StringWriter stringWriter = new StringWriter();
                ResourceSchemaWriter.Write(stringWriter, resourceSchemas[resourceProvider]);
                await Write(stringWriter.ToString(), resourceProvider + ".json", true);

                stringWriter = new StringWriter();
                ResourceMarkdownWriter.Write(stringWriter, resourceSchemas[resourceProvider]);
                await Write(stringWriter.ToString(), resourceProvider + ".md", false);
            }
        }
Пример #3
0
        public override async Task Generate(CodeModel serviceClient)
        {
            IDictionary <string, ResourceSchema> resourceSchemas = ResourceSchemaParser.Parse(serviceClient);

            foreach (string resourceProvider in resourceSchemas.Keys)
            {
                StringWriter stringWriter = new StringWriter();
                ResourceSchemaWriter.Write(stringWriter, resourceSchemas[resourceProvider]);
                await Write(stringWriter.ToString(), resourceProvider + Path.DirectorySeparatorChar + resourceProvider + ".json", true);

                stringWriter = new StringWriter();
                var md = ResourceMarkdownGenerator.Generate(resourceSchemas[resourceProvider]);

                foreach (var m in md)
                {
                    var content = m.Content.Replace("\"boolean\"", "boolean");
                    await Write(content, EnsureUniqueFileName(resourceProvider, m.Type + ".md"), false);
                }
            }
        }
        public override async Task Generate(CodeModel serviceClient)
        {
            var apiVersions = serviceClient.Methods
                              .SelectMany(method => method.XMsMetadata.apiVersions)
                              .Concat(new [] { serviceClient.ApiVersion })
                              .Where(each => each != null)
                              .Distinct().ToArray();

            foreach (var version in apiVersions)
            {
                var resourceSchemas = ResourceSchemaParser.Parse(serviceClient, version);

                foreach (string resourceProvider in resourceSchemas.Keys)
                {
                    using (var stringWriter = new StringWriter())
                    {
                        ResourceSchemaWriter.Write(stringWriter, resourceSchemas[resourceProvider]);

                        await Write(stringWriter.ToString(), Path.Combine(version, resourceProvider + ".json"), true);
                    }
                }
            }
        }