/// <summary> /// Returns an instance of <see cref="PathItem"/> representing this route. /// </summary> /// <param name="description">The <see cref="RouteDescription"/>.</param> /// <param name="action">An <see cref="Action{PathItemBuilder}"/> for building the <see cref="PathItem"/>.</param> /// <returns>An instance of <see cref="PathItem"/> constructed using <paramref name="description"/> and by invoking <paramref name="action"/>.</returns> public static PathItem AsSwagger(this RouteDescription description, Action <PathItemBuilder> action) { var builder = new PathItemBuilder(description.Method.ToHttpMethod()); action.Invoke(builder); return(builder.Build()); }
public void Should_AbleToSetPathWithBuilder() { var info = new Info { Version = "1.0" }; var pathItem = new PathItemBuilder(HttpMethod.Get); var swaggerRoot = builder.Info(info) .Path("/endpoint", pathItem) .Build(); Assert.Equal(pathItem.Build().Get, swaggerRoot.Paths["/endpoint"].Get); }