Пример #1
0
        public void ConfigureOpenApiMetadataRoutes(HttpConfiguration config, bool useSchoolYear)
        {
            Preconditions.ThrowIfNull(config, nameof(config));

            config.Routes.MapHttpRoute(
                name: "OpenApiMetadataIdentity",
                routeTemplate: "metadata/{otherName}/v{identityVersion}/" + RouteConfigurationHelper.CreateSchoolYearSegment(useSchoolYear) +
                "swagger.json",
                defaults: RouteConfigurationHelper.CreateOpenApiMetadataDefaults(),
                constraints: RouteConfigurationHelper.CreateSchoolYearConstraint(useSchoolYear)
                )
            .SetDataTokenRouteName(MetadataRouteConstants.Identity);
        }
Пример #2
0
        private void ConfigureSchemaSpecificMetadataRoute(
            HttpConfiguration config,
            object schoolYearConstraint,
            string schoolYearRoute)
        {
            string schoolYearSegment = schoolYearRoute;
            var    constraints       = schoolYearConstraint;

            config.Routes.MapHttpRoute(
                name: "OpenApiMetadataSchema",
                routeTemplate: "metadata/data/v{apiVersion}/" + schoolYearSegment + "{schemaName}/swagger.json",
                defaults: RouteConfigurationHelper.CreateOpenApiMetadataDefaults(),
                constraints: constraints
                )
            .SetDataTokenRouteName(MetadataRouteConstants.Schema);
        }
        public void ConfigureOpenApiMetadataRoutes(HttpConfiguration config, bool useSchoolYear)
        {
            Preconditions.ThrowIfNull(config, nameof(config));

            var    schoolYearConstraint = RouteConfigurationHelper.CreateSchoolYearConstraint(useSchoolYear);
            var    apiDefaults          = RouteConfigurationHelper.CreateOpenApiMetadataDefaults();
            string schoolYearSegment    = RouteConfigurationHelper.CreateSchoolYearSegment(useSchoolYear);

            config.Routes.MapHttpRoute(
                name: MetadataRouteConstants.Profiles,
                routeTemplate: "metadata/data/v{apiVersion}/" + schoolYearSegment + "profiles/{profileName}/swagger.json",
                defaults: RouteConfigurationHelper.CreateOpenApiMetadataDefaults(),
                constraints: schoolYearConstraint
                )
            .SetDataTokenRouteName(MetadataRouteConstants.Profiles);
        }
        public void ConfigureRoutes(HttpConfiguration config, bool useSchoolYear)
        {
            Preconditions.ThrowIfNull(config, nameof(config));

            config.Routes.MapHttpRoute(
                name: "MetadataSections",
                routeTemplate: "metadata/" + (useSchoolYear
                    ? "{schoolYearFromRoute}"
                    : string.Empty),
                defaults: new
            {
                controller      = "openapimetadata",
                action          = "getsections",
                apiVersion      = ApiVersionConstants.Ods,
                identityVersion = ApiVersionConstants.Identity
            },
                constraints: RouteConfigurationHelper.CreateSchoolYearConstraint(useSchoolYear)
                );
        }
Пример #5
0
        public void ConfigureRoutes(HttpConfiguration config, bool useSchoolYear)
        {
            Preconditions.ThrowIfNull(config, nameof(config));

            var apiDefaults = new
            {
                apiVersion      = ApiVersionConstants.Ods,
                identityVersion = ApiVersionConstants.Identity
            };

            config.Routes.MapHttpRoute(
                name: "ApiDefaultCollection",
                routeTemplate: "data/v{apiVersion}/" + (useSchoolYear
                    ? "{schoolYearFromRoute}/"
                    : string.Empty) + "{schema}/{controller}",
                defaults: apiDefaults,
                constraints: useSchoolYear
                    ? RouteConfigurationHelper.CreateSchoolYearRouteConstraints()
                    : RouteConfigurationHelper.CreateRouteConstraints());

            config.Routes.MapHttpRoute(
                name: "ApiDefaultItem",
                routeTemplate: "data/v{apiVersion}/" + (useSchoolYear
                    ? "{schoolYearFromRoute}/"
                    : string.Empty) + "{schema}/{controller}/{id}",
                defaults: apiDefaults,
                constraints: useSchoolYear
                    ? RouteConfigurationHelper.CreateSchoolYearWithIdRouteConstraints()
                    : RouteConfigurationHelper.CreateIdRouteConstraints());

            config.Routes.MapHttpRoute(
                name: "Root",
                routeTemplate: "",
                defaults: new
            {
                controller = "Version",
                action     = "Index"
            });
        }
        public void ConfigureOpenApiMetadataRoutes(HttpConfiguration config, bool useSchoolYear)
        {
            Preconditions.ThrowIfNull(config, nameof(config));

            // Set up Open API metadata routes
            var apiDefaults = new
            {
                controller = "openapimetadata", compositeVersion = CompositesConstants.FeatureVersion, action = "get"
            };

            var schoolYearConstraint = RouteConfigurationHelper.CreateSchoolYearConstraint(useSchoolYear);

            string schoolYearRoute = RouteConfigurationHelper.CreateSchoolYearSegment(useSchoolYear);

            config.Routes.MapHttpRoute(
                name: MetadataRouteConstants.Composites,
                routeTemplate: "metadata/composites/v{compositeVersion}/" + schoolYearRoute
                + "{organizationCode}/{compositeCategoryName}/swagger.json",
                defaults: apiDefaults,
                constraints: schoolYearConstraint
                ).SetDataTokenRouteName(MetadataRouteConstants.Composites);
        }
Пример #7
0
        public void ConfigureOpenApiMetadataRoutes(HttpConfiguration config, bool useSchoolYear)
        {
            Preconditions.ThrowIfNull(config, nameof(config));

            var schemas = _schemaNameMapProvider.GetSchemaNameMaps()
                          .Select(x => x.UriSegment.ToLowerInvariant())
                          .ToList();

            string schemaNameConstraints = string.Join("|", schemas);

            var    schoolYearConstraint    = RouteConfigurationHelper.CreateSchoolYearConstraint(useSchoolYear);
            var    resourceTypesConstraint = RouteConfigurationHelper.CreateResourceTypesConstraints(useSchoolYear);
            var    apiDefaults             = RouteConfigurationHelper.CreateOpenApiMetadataDefaults();
            string schoolYearRoute         = RouteConfigurationHelper.CreateSchoolYearSegment(useSchoolYear);

            ConfigureResourceTypeMetadataRoutes(config, apiDefaults, resourceTypesConstraint, schoolYearRoute);
            ConfigureComprehensiveMetadataRoute(config, apiDefaults, schoolYearConstraint, schoolYearRoute);
            ConfigureDependencyMetadataRoute(config, schoolYearConstraint, schoolYearRoute);

            ConfigureSchemaSpecificMetadataRoute(
                config,
                RouteConfigurationHelper.CreateSchemaNameConstraint(useSchoolYear, schemaNameConstraints),
                schoolYearRoute);
        }
Пример #8
0
        public void ConfigureRoutes(HttpConfiguration config, bool useSchoolYear)
        {
            Preconditions.ThrowIfNull(config, nameof(config));

            var routeConstraints = RouteConfigurationHelper.CreateSchoolYearConstraint(useSchoolYear);

            var schoolYearSegment = useSchoolYear
                ? "{schoolYearFromRoute}/"
                : string.Empty;

            config.Routes.MapHttpRoute(
                name: "IdentitiesCreate",
                routeTemplate: "identity/v{identityVersion}/" + schoolYearSegment + "identities",
                defaults: new
            {
                identityVersion = ApiVersionConstants.Identity,
                controller      = "Identities",
                action          = "Create"
            },
                constraints: routeConstraints
                );

            config.Routes.MapHttpRoute(
                name: "IdentitiesFind",
                routeTemplate: "identity/v{identityVersion}/" + schoolYearSegment + "identities/find",
                defaults: new
            {
                identityVersion = ApiVersionConstants.Identity,
                controller      = "Identities",
                action          = "Find"
            },
                constraints: routeConstraints
                );

            config.Routes.MapHttpRoute(
                name: "IdentitiesSearch",
                routeTemplate: "identity/v{identityVersion}/" + schoolYearSegment + "identities/search",
                defaults: new
            {
                identityVersion = ApiVersionConstants.Identity,
                controller      = "Identities",
                action          = "Search"
            },
                constraints: routeConstraints
                );

            config.Routes.MapHttpRoute(
                name: "IdentitiesGetById",
                routeTemplate: "identity/v{identityVersion}/" + schoolYearSegment + "identities/{id}",
                defaults: new
            {
                identityVersion = ApiVersionConstants.Identity,
                controller      = "Identities",
                action          = "GetById"
            },
                constraints: routeConstraints
                );

            config.Routes.MapHttpRoute(
                name: "IdentitiesSearchResult",
                routeTemplate: "identity/v{identityVersion}/" + schoolYearSegment + "identities/results/{id}",
                defaults: new
            {
                identityVersion = ApiVersionConstants.Identity,
                controller      = "Identities",
                action          = "Result"
            },
                constraints: routeConstraints
                );
        }