Ejemplo n.º 1
0
        public RouteContextBuilder WithSpec(OpenApiOperation spec)
        {
            var server = new Microsoft.OpenApi.Models.OpenApiServer[0];

            Spec = OpenApiDocumentConverter.ConvertSpec(spec, server);
            return(this);
        }
Ejemplo n.º 2
0
        private static IReadOnlyDictionary <RouteId, RouteSpec> GetRouteSpecs(IEnumerable <OpenApiDocument> specs)
        {
            var result = new Dictionary <RouteId, RouteSpec>();

            foreach (var spec in specs)
            {
                foreach (var(path, pathSpec) in spec.Paths)
                {
                    foreach (var(verb, operation) in pathSpec.Operations)
                    {
                        var key     = GetRouteId(spec, operation, verb, path);
                        var specCtx = OpenApiDocumentConverter.ConvertSpec(operation, spec.Servers);
                        result[key] = specCtx;
                    }
                }
            }

            return(result);
        }