private static IEnumerable <TypeContext> RootInputAndOutputModels(BehaviorChain chain) { var firstCall = chain.FirstCall(); var lastCall = chain.LastCall(); if (firstCall.HasInput && !chain.Route.AllowsGet() && !chain.Route.AllowsDelete()) { var inputType = firstCall.InputType(); inputType = inputType.GetListElementType() ?? inputType; yield return(new TypeContext(inputType, chain: chain)); } if (lastCall.HasOutput) { var outputType = lastCall.OutputType(); outputType = outputType.GetListElementType() ?? outputType; yield return(new TypeContext(outputType)); } }
private Data GetResponse(BehaviorChain chain, EndpointDescription endpoint) { var lastCall = chain.LastCall(); DataType type = null; List <BodyLineItem> description = null; if (lastCall.HasOutput) { type = _typeGraphFactory.BuildGraph(lastCall.OutputType()); description = _bodyDescriptionFactory.Create(type); } return(_configuration.ResponseOverrides.Apply(chain, new Data { Comments = endpoint.ResponseComments, Headers = GetHeaders(chain, HttpDirection.Response), MimeTypes = GetMimeTypes(chain, HttpDirection.Response), Body = new Body { Type = type, Description = description } })); }
private Data GetResponse(BehaviorChain chain, EndpointDescription endpoint) { var lastCall = chain.LastCall(); DataType type = null; List<BodyLineItem> description = null; if (lastCall.HasOutput) { type = _typeGraphFactory.BuildGraph(lastCall.OutputType()); description = _bodyDescriptionFactory.Create(type); } return _configuration.ResponseOverrides.Apply(chain, new Data { Comments = endpoint.ResponseComments, Headers = GetHeaders(chain, HttpDirection.Response), MimeTypes = GetMimeTypes(chain, HttpDirection.Response), Body = new Body { Type = type, Description = description } }); }