public void Given() { var cut = new ActionCallMapper(new TypeDescriptorCache()); var graph = new BehaviorGraph(); var chain = graph.AddActionFor("api/group1/{input}", typeof(Action1)); chain.Route.AddHttpMethodConstraint("POST"); var action = graph.Actions().First(); _result = cut.GetSwaggerOperations(action).First(); }
private API[] createSwaggerAPIs(ResourceRequest request, string baseUrl) { var actions = _connegActionActionFinder.ActionsForGroup(request.GroupKey).ToArray(); var apis = actions.Select(a => { //UGH we need to make relative URLs for swagger to be happy. var pattern = a.ParentChain().Route.Pattern; var resourceUrl = baseUrl.UrlRelativeTo(pattern); var description = a.InputType().GetAttribute <DescriptionAttribute>(d => d.Description); return(new API { path = resourceUrl, description = description, operations = _actionCallMapper.GetSwaggerOperations(a).ToArray() }); }).ToArray(); return(apis); }