diff --git a/.github/workflows/ci-cleanup.yml b/.github/workflows/ci-cleanup.yml index 581edb24ef5..a29da321f82 100644 --- a/.github/workflows/ci-cleanup.yml +++ b/.github/workflows/ci-cleanup.yml @@ -7,7 +7,7 @@ on: jobs: cleanup: - runs-on: ubuntu-latest + runs-on: self-ubuntu steps: - name: Check out code uses: actions/checkout@v3 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d111b471c83..370da01958b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ concurrency: jobs: check-changes: name: Check for Changes - runs-on: ubuntu-latest + runs-on: self-ubuntu if: github.event.pull_request.draft == false outputs: website_changes: ${{ steps.check-website.outputs.website_changes }} @@ -56,7 +56,7 @@ jobs: pr-labeler: name: Apply Labels - runs-on: ubuntu-latest + runs-on: self-ubuntu permissions: contents: read pull-requests: write @@ -67,7 +67,7 @@ jobs: spellcheck: name: "Spellcheck Documentation" - runs-on: ubuntu-latest + runs-on: self-ubuntu needs: check-changes if: needs.check-changes.outputs.website_changes == 'true' steps: @@ -91,7 +91,7 @@ jobs: name: "Website Tests" needs: check-changes if: needs.check-changes.outputs.website_changes == 'true' - runs-on: ubuntu-latest + runs-on: self-ubuntu steps: - name: Checkout Repository uses: actions/checkout@v2 @@ -123,7 +123,7 @@ jobs: configure: name: Generate Test Matrix - runs-on: ubuntu-latest + runs-on: self-ubuntu needs: check-changes if: needs.check-changes.outputs.library_changes == 'true' @@ -150,7 +150,7 @@ jobs: library-tests: name: Run ${{ matrix.name }} - runs-on: ubuntu-latest + runs-on: self-ubuntu needs: [configure, check-changes] if: needs.check-changes.outputs.library_changes == 'true' @@ -277,7 +277,7 @@ jobs: codeql: name: CodeQL - runs-on: ubuntu-latest + runs-on: self-ubuntu needs: check-changes if: needs.check-changes.outputs.src_changes == 'true' @@ -323,7 +323,7 @@ jobs: name: Merge and Upload Coverage needs: library-tests if: always() && needs.library-tests.result != 'cancelled' - runs-on: ubuntu-latest + runs-on: self-ubuntu steps: - name: Checkout repository uses: actions/checkout@v2 @@ -383,7 +383,7 @@ jobs: name: "CI Status Check" needs: [library-tests, website-tests] if: always() - runs-on: ubuntu-latest + runs-on: self-ubuntu steps: - name: Check if Library Tests or Website Tests failed run: exit 1 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e3a241cea4d..6fba47d0e16 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -14,7 +14,7 @@ concurrency: jobs: configure: name: Generate Test Matrix - runs-on: ubuntu-latest + runs-on: self-ubuntu outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} @@ -39,7 +39,7 @@ jobs: library-tests: name: Run ${{ matrix.name }} - runs-on: ubuntu-latest + runs-on: self-ubuntu needs: configure strategy: @@ -115,7 +115,7 @@ jobs: name: Merge and Upload Coverage needs: library-tests if: always() && needs.library-tests.result != 'cancelled' - runs-on: ubuntu-latest + runs-on: self-ubuntu steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs index 8f6566568b2..fb8f70fd377 100644 --- a/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs +++ b/src/HotChocolate/AspNetCore/src/AspNetCore/Extensions/EndpointRouteBuilderExtensions.cs @@ -78,13 +78,52 @@ public static GraphQLEndpointConventionBuilder MapGraphQL( var requestPipeline = endpointRouteBuilder.CreateApplicationBuilder(); var schemaNameOrDefault = schemaName ?? Schema.DefaultName; - requestPipeline + requestPipeline.MapGraphQL(path, schemaNameOrDefault); + + return new GraphQLEndpointConventionBuilder( + endpointRouteBuilder + .Map(pattern, requestPipeline.Build()) + .WithDisplayName("Hot Chocolate GraphQL Pipeline")); + } + + /// + /// Adds a GraphQL endpoint to the endpoint configurations. + /// + /// + /// The . + /// + /// + /// The path to which the GraphQL endpoint shall be mapped. + /// + /// + /// The name of the schema that shall be used by this endpoint. + /// + /// + /// Returns the so that + /// configuration can be chained. + /// + /// + /// The is null. + /// + public static IApplicationBuilder MapGraphQL( + this IApplicationBuilder applicationBuilder, + PathString path, + string schemaName) + { + if (applicationBuilder is null) + { + throw new ArgumentNullException(nameof(applicationBuilder)); + } + + path = path.ToString().TrimEnd('/'); + + applicationBuilder .UseCancellation() - .UseMiddleware(schemaNameOrDefault) - .UseMiddleware(schemaNameOrDefault) - .UseMiddleware(schemaNameOrDefault) - .UseMiddleware(schemaNameOrDefault) - .UseMiddleware(schemaNameOrDefault, Integrated) + .UseMiddleware(schemaName) + .UseMiddleware(schemaName) + .UseMiddleware(schemaName) + .UseMiddleware(schemaName) + .UseMiddleware(schemaName, Integrated) .UseBananaCakePop(path) .Use(_ => context => { @@ -92,10 +131,7 @@ public static GraphQLEndpointConventionBuilder MapGraphQL( return Task.CompletedTask; }); - return new GraphQLEndpointConventionBuilder( - endpointRouteBuilder - .Map(pattern, requestPipeline.Build()) - .WithDisplayName("Hot Chocolate GraphQL Pipeline")); + return applicationBuilder; } ///