public RamlDocWrapper(string ramlFilePath) { //MuleSoft Raml parser var parser = new RamlParser(); try { ramlDocument = parser.LoadAsync(ramlFilePath).Result; } catch (AggregateException ae) //Exceptions received from assync RamlParser { throw ae.Flatten(); } }
public Program() { var parser = new RamlParser(); var raml = parser.LoadAsync(@"c:\temp\test.raml").Result; var apiName = Helpers.GetMethodOrClassName(raml.Title); var apiBaseUrl = new Uri(raml.BaseUri); var api = new Api(apiName, apiBaseUrl); foreach (var resource in raml.Resources) { foreach (var method in resource.Methods) { if (string.IsNullOrEmpty(method.Description)) { throw new Exception(string.Format("{0} method on {1} has no description", method, resource.RelativeUri)); } var apiMethodName = Helpers.GetMethodOrClassName(method.Description); var apiMethodHasBody = (method.Verb == "post" || method.Verb == "put" || method.Verb == "patch") && method.Body != null && method.Body.Any(); var apiMethod = new Method(apiMethodName, method.Verb, resource.RelativeUri, apiMethodHasBody); if (method.QueryParameters != null) { foreach (var parameter in method.QueryParameters) { var apiMethodQueryParameterName = Helpers.ToCamelCase(parameter.Key); var apiMethodQueryParameter = new QueryParameter(apiMethodQueryParameterName, parameter.Value.Required); apiMethod.AddQueryParameter(apiMethodQueryParameter); } } api.AddMethod(apiMethod); } } var ts = api.ToTypescript(); ts += ""; }
private async Task<ClientGeneratorModel> GetContactsGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/contacts.raml"); return new ClientGeneratorService(raml, "test").BuildModel(); }
private async Task<WebApiGeneratorModel> GetGitHubGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/github.raml"); return new WebApiGeneratorService(raml, "TestNs").BuildModel(); }
private async Task<WebApiGeneratorModel> GetCongoGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/congo-drones-5-f.raml"); return new WebApiGeneratorService(raml, "TestNs").BuildModel(); }
private async Task<WebApiGeneratorModel> GetTwitterGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/twitter.raml"); return new WebApiGeneratorService(raml).BuildModel(); }
private async Task<ClientGeneratorModel> GetGitHubGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/github.raml"); return new ClientGeneratorService(raml, "test", "TargetNamespace").BuildModel(); }
private async Task<ClientGeneratorModel> GetCongoGeneratedModel() { var parser = new RamlParser(); var raml = await parser.LoadAsync("files/congo-drones-5-f.raml"); return new ClientGeneratorService(raml, "test", "TargetNamespace").BuildModel(); }