public override async Task Generate(CodeModel serviceClient)
        {
            var apiVersions = serviceClient.Methods
                              .Select(method => method.Parameters.FirstOrDefault(p => p.SerializedName == "api-version")?.DefaultValue.Value)
                              .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)
                {
                    var stringWriter = new StringWriter();
                    ResourceSchemaWriter.Write(stringWriter, resourceSchemas[resourceProvider]);
                    await Write(stringWriter.ToString(), Path.Combine(version, resourceProvider + ".json"), true);

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

                    foreach (var m in md)
                    {
                        var content = m.Content.Replace("\"boolean\"", "boolean");
                        // place nested topics in subdirectories
                        await Write(content, Path.Combine(version, m.Type.Replace('_', Path.DirectorySeparatorChar) + ".md"), false);
                    }
                }
            }
        }
Beispiel #2
0
        public override async Task Generate(CodeModel serviceClient)
        {
            var multiScope = await Settings.Instance.Host?.GetValue <bool?>("multi-scope") ?? false;

            var apiVersions = serviceClient.Methods
                              .Select(method => method.Parameters.FirstOrDefault(p => p.SerializedName == "api-version")?.DefaultValue.Value)
                              .Concat(new [] { serviceClient.ApiVersion })
                              .Where(each => each != null)
                              .Distinct().ToArray();

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

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

/*
 *                  var md = ResourceMarkdownGenerator.Generate(resourceSchemas[resourceProvider]);
 *
 *                  foreach (var m in md)
 *                  {
 *                      // what the heck was this doing in the first place!??!
 *                      // var content = m.Content.Replace("\"boolean\"", "boolean");
 *                      var content = m.Content;
 *                      // place nested topics in subdirectories
 *                      await Write(content, Path.Combine(version, m.Type.Replace('_', Path.DirectorySeparatorChar) + ".md"), false);
 *                  }
 */
                }
            }
        }
Beispiel #3
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);
            }
        }
        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);
            }
        }
Beispiel #5
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);
                    }
                }
            }
        }