Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ChilliCream/graphql-platform
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 11.3.1
Choose a base ref
...
head repository: ChilliCream/graphql-platform
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 11.3.2
Choose a head ref
  • 12 commits
  • 72 files changed
  • 6 contributors

Commits on Jun 28, 2021

  1. Copy the full SHA
    ff81245 View commit details

Commits on Jul 1, 2021

  1. Copy the full SHA
    b5e3c75 View commit details

Commits on Jul 6, 2021

  1. Copy the full SHA
    3d6a296 View commit details

Commits on Jul 7, 2021

  1. Copy the full SHA
    e45e9d7 View commit details

Commits on Jul 14, 2021

  1. Expand resolver documentation (#3802)

    Co-authored-by: Ben McCallum <ben.mccallum@live.com.au>
    tobias-tengler and benmccallum authored Jul 14, 2021
    Copy the full SHA
    22755ec View commit details

Commits on Jul 15, 2021

  1. add xm logo (#3950)

    arif-hanif authored Jul 15, 2021
    Copy the full SHA
    b645405 View commit details
  2. Copy the full SHA
    c2a4721 View commit details

Commits on Jul 16, 2021

  1. Fixed url (#3955)

    michaelstaib authored Jul 16, 2021
    Copy the full SHA
    94c331e View commit details
  2. Copy the full SHA
    ff687a5 View commit details
  3. added ability to opt out from forward/backwards cursor pagination (#2528

    )
    
    Co-authored-by: Pascal Senn <senn.pasc@gmail.com>
    icanhasjonas and PascalSenn authored Jul 16, 2021
    Copy the full SHA
    8a8c6aa View commit details

Commits on Jul 20, 2021

  1. Copy the full SHA
    18aae91 View commit details

Commits on Jul 21, 2021

  1. Copy the full SHA
    84f25b8 View commit details
Showing with 2,583 additions and 896 deletions.
  1. +59 −13 src/HotChocolate/Core/src/Types.CursorPagination/Extensions/PagingObjectFieldDescriptorExtensions.cs
  2. +21 −7 src/HotChocolate/Core/src/Types.CursorPagination/Extensions/UsePagingAttribute.cs
  3. +1 −0 src/HotChocolate/Core/src/Types/PublicAPI.Shipped.txt
  4. +0 −1 src/HotChocolate/Core/src/Types/PublicAPI.Unshipped.txt
  5. +2 −0 src/HotChocolate/Core/src/Types/Types/Pagination/PagingDefaults.cs
  6. +5 −0 src/HotChocolate/Core/src/Types/Types/Pagination/PagingOptions.cs
  7. +34 −1 src/HotChocolate/Core/test/Types.CursorPagination.Tests/IntegrationTests.cs
  8. +68 −0 ...st/Types.CursorPagination.Tests/__snapshots__/IntegrationTests.Deactivate_BackwardPagination.snap
  9. +72 −0 ...ursorPagination.Tests/__snapshots__/IntegrationTests.Deactivate_BackwardPagination_Interface.snap
  10. +1 −1 src/HotChocolate/Data/src/Data/Projections/Convention/ProjectionConvention.cs
  11. +42 −30 src/HotChocolate/Data/src/Data/Projections/Optimizers/IsProjectedProjectionOptimizer.cs
  12. +43 −1 ...hocolate/Data/test/Data.Projections.SqlServer.Tests/QueryableProjectionVisitorIsProjectedTests.cs
  13. +12 −0 ...isitorIsProjectedTests.IsProjected_Should_AlwaysBeProjectedWhenSelected_When_TrueAndMultiple.snap
  14. +2 −0 ...rIsProjectedTests.IsProjected_Should_AlwaysBeProjectedWhenSelected_When_TrueAndMultiple__sql.snap
  15. +126 −51 src/HotChocolate/Utilities/src/Utilities/Cache.cs
  16. +114 −2 src/HotChocolate/Utilities/test/Utilities.Tests/CacheTests.cs
  17. +3 −1 src/StrawberryShake/Client/src/Core/PublicAPI.Shipped.txt
  18. +0 −4 src/StrawberryShake/Client/src/Core/PublicAPI.Unshipped.txt
  19. +3 −7 website/gatsby-config.js
  20. +175 −0 website/src/blog/2021-07-20-rider-language-injection/2021-07-20-rider-language-injection.md
  21. BIN website/src/blog/2021-07-20-rider-language-injection/header.png
  22. BIN website/src/blog/2021-07-20-rider-language-injection/language-injection-settings.png
  23. BIN website/src/blog/2021-07-20-rider-language-injection/lookandfeel.png
  24. BIN website/src/blog/2021-07-20-rider-language-injection/preferences.png
  25. BIN website/src/blog/2021-07-20-rider-language-injection/rider-language-injection.png
  26. +1 −1 website/src/components/articles/article-elements.tsx
  27. +5 −4 website/src/components/articles/article-sections.tsx
  28. +2 −2 website/src/components/articles/article.tsx
  29. +2 −2 website/src/components/blog-article/blog-article-metadata.tsx
  30. +3 −3 website/src/components/blog-article/blog-article-tags.tsx
  31. +4 −5 website/src/components/doc-page/doc-page-community.tsx
  32. +3 −4 website/src/components/doc-page/doc-page-legacy.tsx
  33. +294 −297 website/src/components/doc-page/doc-page-navigation.tsx
  34. +8 −11 website/src/components/doc-page/doc-page-pane-header.tsx
  35. +84 −16 website/src/components/doc-page/doc-page.tsx
  36. +1 −1 website/src/components/images/blog-post-chillicream-platform-11-1.tsx
  37. +1 −1 website/src/components/images/blog-post-ef-meets-graphql.tsx
  38. +1 −1 website/src/components/images/blog-post-version-11.tsx
  39. +3 −3 website/src/components/mdx/code-block.tsx
  40. +3 −3 website/src/components/mdx/copy.tsx
  41. +12 −0 website/src/components/mdx/inline-code.tsx
  42. +3 −3 website/src/components/mdx/tabs/tab.tsx
  43. +10 −10 website/src/components/misc/global-style.tsx
  44. +3 −4 website/src/components/misc/marketing-elements.tsx
  45. +2 −2 website/src/components/misc/page-elements.tsx
  46. +2 −2 website/src/components/misc/pagination.tsx
  47. +16 −17 website/src/components/misc/search.tsx
  48. +9 −9 website/src/components/structure/header.tsx
  49. +2 −0 website/src/components/structure/layout.tsx
  50. +16 −17 website/src/components/structure/main-content-container/footer.tsx
  51. +1 −1 website/src/components/support/sales-card.tsx
  52. +4 −4 website/src/components/widgets/blog-articles.tsx
  53. +29 −7 website/src/docs/docs.json
  54. +11 −2 website/src/docs/hotchocolate/defining-a-schema/input-object-types.md
  55. +46 −10 website/src/docs/hotchocolate/defining-a-schema/object-types.md
  56. +24 −264 website/src/docs/hotchocolate/fetching-data/index.md
  57. +563 −0 website/src/docs/hotchocolate/fetching-data/resolvers.md
  58. +173 −0 website/src/docs/hotchocolate/security/authentication.md
  59. +376 −0 website/src/docs/hotchocolate/security/authorization.md
  60. +23 −0 website/src/docs/hotchocolate/security/index.md
  61. +1 −1 website/src/docs/strawberryshake/configuration.md
  62. +4 −4 website/src/docs/strawberryshake/get-started/console.md
  63. +3 −3 website/src/docs/strawberryshake/get-started/index.md
  64. +3 −3 website/src/docs/strawberryshake/get-started/xamarin.md
  65. +4 −4 website/src/docs/strawberryshake/networking/authentication.md
  66. +23 −0 website/src/images/companies/xm.svg
  67. +1 −1 website/src/pages/404.tsx
  68. +19 −12 website/src/pages/index.tsx
  69. +1 −1 website/src/partials/sales-partial.tsx
  70. +0 −8 website/src/state/common/common.actions.ts
  71. +1 −32 website/src/state/common/common.reducer.ts
  72. +0 −2 website/src/state/common/common.state.ts
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
using HotChocolate.Types.Descriptors;
using HotChocolate.Types.Pagination;
using static HotChocolate.Utilities.ThrowHelper;
using static HotChocolate.Types.Pagination.PagingDefaults;

namespace HotChocolate.Types
{
@@ -41,15 +42,29 @@ public static IObjectFieldDescriptor UsePaging(

resolvePagingProvider ??= ResolvePagingProvider;

descriptor.AddPagingArguments();

PagingHelper.UsePaging(
descriptor,
type,
entityType,
(services, source) => resolvePagingProvider(services, source),
options);

descriptor
.Extend()
.OnBeforeCreate((c, d) =>
{
if (!(c.ContextData.TryGetValue(typeof(PagingOptions).FullName!, out var obj) &&
obj is PagingOptions pagingOptions))
{
pagingOptions = default;
}

var descriptor = ObjectFieldDescriptor.From(c, d);
descriptor.AddPagingArguments(
pagingOptions.AllowBackwardPagination ?? AllowBackwardPagination);
descriptor.CreateDefinition();
});

descriptor
.Extend()
.OnBeforeCreate(
@@ -76,7 +91,22 @@ public static IInterfaceFieldDescriptor UsePaging(
}

descriptor
.AddPagingArguments()
.Extend()
.OnBeforeCreate((c, d) =>
{
if (!(c.ContextData.TryGetValue(typeof(PagingOptions).FullName!, out var obj) &&
obj is PagingOptions pagingOptions))
{
pagingOptions = default;
}

var descriptor = InterfaceFieldDescriptor.From(c, d);
descriptor.AddPagingArguments(
pagingOptions.AllowBackwardPagination ?? AllowBackwardPagination);
descriptor.CreateDefinition();
});

descriptor
.Extend()
.OnBeforeCreate(
(c, d) => d.Type = CreateConnectionTypeRef(c, d.Member, type, options));
@@ -85,33 +115,49 @@ public static IInterfaceFieldDescriptor UsePaging(
}

public static IObjectFieldDescriptor AddPagingArguments(
this IObjectFieldDescriptor descriptor)
this IObjectFieldDescriptor descriptor,
bool allowBackwardPagination = true)
{
if (descriptor == null)
{
throw new ArgumentNullException(nameof(descriptor));
}

return descriptor
descriptor
.Argument(CursorPagingArgumentNames.First, a => a.Type<IntType>())
.Argument(CursorPagingArgumentNames.After, a => a.Type<StringType>())
.Argument(CursorPagingArgumentNames.Last, a => a.Type<IntType>())
.Argument(CursorPagingArgumentNames.Before, a => a.Type<StringType>());
.Argument(CursorPagingArgumentNames.After, a => a.Type<StringType>());

if (allowBackwardPagination)
{
descriptor
.Argument(CursorPagingArgumentNames.Last, a => a.Type<IntType>())
.Argument(CursorPagingArgumentNames.Before, a => a.Type<StringType>());
}

return descriptor;
}

public static IInterfaceFieldDescriptor AddPagingArguments(
this IInterfaceFieldDescriptor descriptor)
this IInterfaceFieldDescriptor descriptor,
bool allowBackwardPagination = true)
{
if (descriptor == null)
{
throw new ArgumentNullException(nameof(descriptor));
}

return descriptor
descriptor
.Argument(CursorPagingArgumentNames.First, a => a.Type<IntType>())
.Argument(CursorPagingArgumentNames.After, a => a.Type<StringType>())
.Argument(CursorPagingArgumentNames.Last, a => a.Type<IntType>())
.Argument(CursorPagingArgumentNames.Before, a => a.Type<StringType>());
.Argument(CursorPagingArgumentNames.After, a => a.Type<StringType>());

if (allowBackwardPagination)
{
descriptor
.Argument(CursorPagingArgumentNames.Last, a => a.Type<IntType>())
.Argument(CursorPagingArgumentNames.Before, a => a.Type<StringType>());
}

return descriptor;
}

private static ITypeReference CreateConnectionTypeRef(
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ public sealed class UsePagingAttribute : DescriptorAttribute
private int? _defaultPageSize;
private int? _maxPageSize;
private bool? _includeTotalCount;
private bool? _allowBackwardPagination;

/// <summary>
/// Applies the offset paging middleware to the annotated property.
@@ -28,11 +29,13 @@ public UsePagingAttribute(Type? type = null)
/// <summary>
/// The schema type representation of the item type.
/// </summary>

public Type? SchemaType
{
[Obsolete("Use Type.")] get => Type;
[Obsolete("Use the new constructor.")] set => Type = value;

public Type? SchemaType
{
[Obsolete("Use Type.")]
get => Type;
[Obsolete("Use the new constructor.")]
set => Type = value;
}

/// <summary>
@@ -67,6 +70,15 @@ public bool IncludeTotalCount
set => _includeTotalCount = value;
}

/// <summary>
/// Allow backward paging using <c>last</c> and <c>before</c>
/// </summary>
public bool AllowBackwardPagination
{
get => _allowBackwardPagination ?? PagingDefaults.AllowBackwardPagination;
set => _allowBackwardPagination = value;
}

protected override void TryConfigure(
IDescriptorContext context,
IDescriptor descriptor,
@@ -82,7 +94,8 @@ protected override void TryConfigure(
{
DefaultPageSize = _defaultPageSize,
MaxPageSize = _maxPageSize,
IncludeTotalCount = _includeTotalCount
IncludeTotalCount = _includeTotalCount,
AllowBackwardPagination = AllowBackwardPagination
});
}
else if (descriptor is IInterfaceFieldDescriptor ifd)
@@ -93,7 +106,8 @@ protected override void TryConfigure(
{
DefaultPageSize = _defaultPageSize,
MaxPageSize = _maxPageSize,
IncludeTotalCount = _includeTotalCount
IncludeTotalCount = _includeTotalCount,
AllowBackwardPagination = AllowBackwardPagination
});
}
}
1 change: 1 addition & 0 deletions src/HotChocolate/Core/src/Types/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -3189,6 +3189,7 @@ static HotChocolate.ResolverContextExtensions.GetOrAddGlobalValue<T>(this HotCho
static HotChocolate.ResolverContextExtensions.GetOrAddLocalValue<T>(this HotChocolate.Resolvers.IResolverContext! context, string! name, System.Func<string!, T>! createValue) -> T
static HotChocolate.ResolverContextExtensions.GetOrAddScopedValue<T>(this HotChocolate.Resolvers.IResolverContext! context, string! name, System.Func<string!, T>! createValue) -> T
static HotChocolate.ResolverContextExtensions.GetScopedValue<T>(this HotChocolate.Resolvers.IResolverContext! context, string! name) -> T
static HotChocolate.ResolverContextExtensions.GetUser(this HotChocolate.Resolvers.IResolverContext! context) -> System.Security.Claims.ClaimsPrincipal?
static HotChocolate.ResolverContextExtensions.RemoveGlobalValue(this HotChocolate.Resolvers.IResolverContext! context, string! name) -> void
static HotChocolate.ResolverContextExtensions.RemoveLocalValue(this HotChocolate.Resolvers.IResolverContext! context, string! name) -> void
static HotChocolate.ResolverContextExtensions.RemoveScopedValue(this HotChocolate.Resolvers.IResolverContext! context, string! name) -> void
1 change: 0 additions & 1 deletion src/HotChocolate/Core/src/Types/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
static HotChocolate.ResolverContextExtensions.GetUser(this HotChocolate.Resolvers.IResolverContext! context) -> System.Security.Claims.ClaimsPrincipal?
Original file line number Diff line number Diff line change
@@ -7,5 +7,7 @@ public static class PagingDefaults
public const int MaxPageSize = 50;

public const bool IncludeTotalCount = false;

public const bool AllowBackwardPagination = true;
}
}
Original file line number Diff line number Diff line change
@@ -20,5 +20,10 @@ public struct PagingOptions
/// shall be included into the paging result type.
/// </summary>
public bool? IncludeTotalCount { get; set; }

/// <summary>
/// Defines if backward pagination is allowed or deactivated
/// </summary>
public bool? AllowBackwardPagination { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -611,6 +611,39 @@ public async Task Attribute_Interface_With_Paging_Field()
schema.Print().MatchSnapshot();
}

[Fact]
public async Task Deactivate_BackwardPagination()
{
IRequestExecutor executor =
await new ServiceCollection()
.AddGraphQL()
.AddQueryType<QueryType>()
.SetPagingOptions(new PagingOptions { AllowBackwardPagination = false })
.Services
.BuildServiceProvider()
.GetRequestExecutorAsync();

executor.Schema.Print().MatchSnapshot();
}

[Fact]
public async Task Deactivate_BackwardPagination_Interface()
{
Snapshot.FullName();

ISchema schema =
await new ServiceCollection()
.AddGraphQL()
.AddQueryType<QueryAttr>()
.SetPagingOptions(new PagingOptions { AllowBackwardPagination = false })
.AddInterfaceType<ISome>(d => d.Field(t => t.ExplicitType()).UsePaging())
.Services
.BuildServiceProvider()
.GetSchemaAsync();

schema.Print().MatchSnapshot();
}

public class QueryType : ObjectType<Query>
{
protected override void Configure(IObjectTypeDescriptor<Query> descriptor)
@@ -755,7 +788,7 @@ public MockExecutable(IQueryable<T> source)
_source = source;
}

public object Source =>_source;
public object Source => _source;

public ValueTask<IList> ToListAsync(CancellationToken cancellationToken)
{
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
schema {
query: Query
}

type Foo {
bar: String!
}

"A connection to a list of items."
type FooConnection {
"Information to aid in pagination."
pageInfo: PageInfo!
"A list of edges."
edges: [FooEdge!]
"A flattened list of the nodes."
nodes: [[Foo!]!]
totalCount: Int!
}

"An edge in a connection."
type FooEdge {
"A cursor for use in pagination."
cursor: String!
"The item at the end of the edge."
node: [Foo!]!
}

"Information about pagination in a connection."
type PageInfo {
"Indicates whether more edges exist following the set defined by the clients arguments."
hasNextPage: Boolean!
"Indicates whether more edges exist prior the set defined by the clients arguments."
hasPreviousPage: Boolean!
"When paginating backwards, the cursor to continue."
startCursor: String
"When paginating forwards, the cursor to continue."
endCursor: String
}

type Query {
letters(first: Int after: String): StringConnection
explicitType(first: Int after: String): StringConnection
nestedObjectList(first: Int after: String): FooConnection
}

"A connection to a list of items."
type StringConnection {
"Information to aid in pagination."
pageInfo: PageInfo!
"A list of edges."
edges: [StringEdge!]
"A flattened list of the nodes."
nodes: [String!]
}

"An edge in a connection."
type StringEdge {
"A cursor for use in pagination."
cursor: String!
"The item at the end of the edge."
node: String!
}

"The `@defer` directive may be provided for fragment spreads and inline fragments to inform the executor to delay the execution of the current fragment to indicate deprioritization of the current fragment. A query with `@defer` directive will cause the request to potentially return multiple responses, where non-deferred data is delivered in the initial response and data deferred is delivered in a subsequent response. `@include` and `@skip` take precedence over `@defer`."
directive @defer("If this argument label has a value other than null, it will be passed on to the result of this defer directive. This label is intended to give client applications a way to identify to which fragment a deferred result belongs to." label: String "Deferred when true." if: Boolean) on FRAGMENT_SPREAD | INLINE_FRAGMENT

"The `@stream` directive may be provided for a field of `List` type so that the backend can leverage technology such as asynchronous iterators to provide a partial list in the initial response, and additional list items in subsequent responses. `@include` and `@skip` take precedence over `@stream`."
directive @stream("If this argument label has a value other than null, it will be passed on to the result of this stream directive. This label is intended to give client applications a way to identify to which fragment a streamed result belongs to." label: String "The initial elements that shall be send down to the consumer." initialCount: Int! "Streamed when true." if: Boolean!) on FIELD
Loading