public void BuildSwaggerWithURL() { string urlPath = @"http://localhost:2598/swagger/docs/BodyTrace"; APIBuilder builder = APIBuilder.GetBuilder(urlPath); Assert.IsNotNull(builder); }
public void BuildAPIWithSwaggerReader() { string urlPath = @"http://localhost:2598/swagger/docs/Echo"; AbstractSwaggerReader swaggerReader = new SwaggerUrlReader(urlPath); APIBuilder builder = APIBuilder.GetBuilder(swaggerReader); API api = builder.BuildAPIAndOperations(); Assert.IsNotNull(api); Assert.IsNotNull(api.Id); Assert.IsNotNull(api.Operations); Assert.IsTrue(api.Operations.Count > 0); }
public void BuildSwaggerWithSwaggerReader() { string urlPath = @"https://fitabasedev.azure-api.net/swagger/DailyActivity"; List <KeyValuePair <string, string> > headerList = new List <KeyValuePair <string, string> >(); headerList.Add(new KeyValuePair <string, string>("Ocp-Apim-Subscription-Key", "362453116f0948dea2461856d29b310f")); AbstractSwaggerReader swaggerReader = new AuthorizedSwaggerUrlReader(urlPath, headerList); APIBuilder builder = APIBuilder.GetBuilder(swaggerReader); Assert.IsNotNull(builder); }
public void PublishSwaggerAPI() { string url = @"http://localhost:2598/swagger/docs/Profiles"; APIBuilder builder = APIBuilder.GetBuilder(url); API api = builder.BuildAPIAndOperations(); var entity = _Client.CreateAPIAsync(api).Result; Assert.IsNotNull(entity); foreach (var operation in api.Operations) { var entityOperation = _Client.CreateAPIOperationAsync(entity, operation).Result; Assert.IsNotNull(entityOperation); } }
public void ReadLocalOperation() { string filePath = @"C:\Users\inter\Downloads\swaggerOperation.json"; AbstractSwaggerReader swaggerReader = new SwaggerFileReader(filePath); APIBuilder builder = APIBuilder.GetBuilder(swaggerReader); ICollection <APIOperation> operations = builder.BuildAPIAndOperations().Operations; string apiId = "api_577edd5ee62543d297bd5d568af78a82"; API entity = _Client.GetAPIAsync(apiId).Result; string json = JsonConvert.SerializeObject(entity.Operations); foreach (APIOperation o in operations) { try { APIOperation e = _Client.CreateAPIOperationAsync(entity, o).Result; } catch (Exception) { } } }
public void ReadLocalSwaggerFile() { var setting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; string filePath = @"C:\Users\inter\Downloads\swagger.json"; AbstractSwaggerReader swaggerReader = new SwaggerFileReader(filePath); APIBuilder builder = APIBuilder.GetBuilder(swaggerReader); API api = builder.BuildAPIAndOperations(); API entity = _Client.CreateAPIAsync(api).Result; foreach (APIOperation o in api.Operations) { try { APIOperation e = _Client.CreateAPIOperationAsync(entity, o).Result; } catch (Exception) { } } }