示例#1
0
        private static List <string> RenderRelativeRefsForQuery(EndpointMethodMetadata endpointMethodMetadata, bool useForBadRequest = false)
        {
            var renderRelativeRefs = new List <string>();

            var queryRequiredParameters = endpointMethodMetadata.GetQueryRequiredParameters();

            if (queryRequiredParameters.Count == 0)
            {
                if (!useForBadRequest)
                {
                    // Create without queryParameters
                    renderRelativeRefs.Add(RenderRelativeRefsForQueryHelper(endpointMethodMetadata, null, useForBadRequest));
                }
            }
            else
            {
                var queryParameters = endpointMethodMetadata.GetQueryParameters();
                var combinationOfQueryParameters = ParameterCombinationHelper.GetCombination(queryParameters, useForBadRequest);
                foreach (var parameters in combinationOfQueryParameters)
                {
                    renderRelativeRefs.Add(RenderRelativeRefsForQueryHelper(endpointMethodMetadata, parameters, useForBadRequest));
                }
            }

            return(renderRelativeRefs);
        }
示例#2
0
        private static List <string> RenderRelativeRefsForBadRequestInPath(EndpointMethodMetadata endpointMethodMetadata, bool useForBadRequest = false)
        {
            var renderRelativeRefs = new List <string>();

            var allRouteParameters        = endpointMethodMetadata.GetRouteParameters();
            var badRequestRouteParameters = FindBadRequestRouteParameters(allRouteParameters);

            if (badRequestRouteParameters.Count <= 0)
            {
                return(renderRelativeRefs);
            }

            var combinationOfRouteParameters = ParameterCombinationHelper.GetCombination(badRequestRouteParameters, useForBadRequest);

            foreach (var parameters in combinationOfRouteParameters)
            {
                renderRelativeRefs.Add(RenderRelativeRefsForPathHelper(endpointMethodMetadata, allRouteParameters, parameters, useForBadRequest));
            }

            return(renderRelativeRefs);
        }
示例#3
0
        private static List <string> RenderRelativeRefsForPath(EndpointMethodMetadata endpointMethodMetadata, bool useForBadRequest = false)
        {
            var renderRelativeRefs = new List <string>();

            var routeParameters = endpointMethodMetadata.GetRouteParameters()
                                  .Where(x => x.Schema.GetDataType() != OpenApiDataTypeConstants.String)
                                  .ToList();

            if (routeParameters.Count <= 0)
            {
                return(renderRelativeRefs);
            }

            var combinationOfRouteParameters = ParameterCombinationHelper.GetCombination(routeParameters, useForBadRequest);

            foreach (var parameters in combinationOfRouteParameters)
            {
                renderRelativeRefs.Add(RenderRelativeRefsForPathHelper(endpointMethodMetadata, routeParameters, parameters, useForBadRequest));
            }

            return(renderRelativeRefs);
        }