Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused scalars from SDL #1423

Merged
merged 24 commits into from
Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/GraphQL.ApiTests/ApiApprovalTests.PublicApi.approved.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ namespace GraphQL
public static bool IsSubtypeOf(this GraphQL.Types.IGraphType maybeSubType, GraphQL.Types.IGraphType superType, GraphQL.Types.ISchema schema) { }
public static System.Collections.Generic.IEnumerable<string> IsValidLiteralValue(this GraphQL.Types.IGraphType type, GraphQL.Language.AST.IValue valueAst, GraphQL.Types.ISchema schema) { }
public static string NameOf<TSourceType, TProperty>(this System.Linq.Expressions.Expression<System.Func<TSourceType, TProperty>> expression) { }
public static bool References(this GraphQL.Types.ISchema schema, string typeName) { }
public static string TrimGraphQLTypes(this string name) { }
public static TMetadataProvider WithMetadata<TMetadataProvider>(this TMetadataProvider provider, string key, object value)
where TMetadataProvider : GraphQL.Types.IProvideMetadata { }
Expand Down Expand Up @@ -2348,7 +2349,7 @@ namespace GraphQL.Utilities
public class SchemaPrinterOptions
{
public SchemaPrinterOptions() { }
public System.Collections.Generic.List<string> CustomScalars { get; set; }
public bool IncludeAllTypes { get; set; }
public bool IncludeDeprecationReasons { get; set; }
public bool IncludeDescriptions { get; set; }
public bool OldImplementsSyntax { get; set; }
Expand Down
96 changes: 0 additions & 96 deletions src/GraphQL.Tests/Execution/RegisteredInstanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,42 +109,10 @@ public void build_nested_type_with_list()
query: root
}

scalar BigInt

scalar Byte

scalar Date

scalar DateTime

scalar DateTimeOffset

scalar Decimal

scalar Guid

scalar Long

scalar Milliseconds

type NestedObjType {
intField: Int
}

scalar SByte

scalar Seconds

scalar Short

scalar UInt

scalar ULong

scalar UShort

scalar Uri

type root {
listOfObjField: [NestedObjType]
}
Expand All @@ -158,42 +126,10 @@ public void build_nested_type_with_non_null()
query: root
}

scalar BigInt

scalar Byte

scalar Date

scalar DateTime

scalar DateTimeOffset

scalar Decimal

scalar Guid

scalar Long

scalar Milliseconds

type NestedObjType {
intField: Int
}

scalar SByte

scalar Seconds

scalar Short

scalar UInt

scalar ULong

scalar UShort

scalar Uri

type root {
listOfObjField: NestedObjType!
}
Expand All @@ -207,42 +143,10 @@ public void build_nested_type_with_base()
query: root
}

scalar BigInt

scalar Byte

scalar Date

scalar DateTime

scalar DateTimeOffset

scalar Decimal

scalar Guid

scalar Long

scalar Milliseconds

type NestedObjType {
intField: Int
}

scalar SByte

scalar Seconds

scalar Short

scalar UInt

scalar ULong

scalar UShort

scalar Uri

type root {
listOfObjField: NestedObjType
}
Expand Down
34 changes: 1 addition & 33 deletions src/GraphQL.Tests/Utilities/FederatedSchemaBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,10 @@ public void returns_sdl()

var query = "{ _service { sdl } }";

var sdl = @"scalar BigInt

scalar Byte

scalar Date

scalar DateTime

scalar DateTimeOffset

scalar Decimal

scalar Guid

scalar Long

scalar Milliseconds

extend type Query {
var sdl = @"extend type Query {
me: User
}

scalar SByte

scalar Seconds

scalar Short

scalar UInt

scalar ULong

scalar UShort

scalar Uri

type User @key(fields: ""id"") {
id: ID! @external
username: String!
Expand Down
96 changes: 7 additions & 89 deletions src/GraphQL.Tests/Utilities/SchemaPrinterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public class SchemaPrinterTests

private string print(ISchema schema)
{
return print(schema, new SchemaPrinterOptions { IncludeDescriptions = true });
return print(schema, new SchemaPrinterOptions { IncludeDescriptions = true, IncludeAllTypes = true });
}

private string print(ISchema schema, SchemaPrinterOptions options)
Expand Down Expand Up @@ -263,11 +263,12 @@ public void prints_object_field_with_field_descriptions()
var root = new ObjectGraphType { Name = "Query" };
root.Field<FooType>("foo");

var schema = new Schema {Query = root};
var schema = new Schema { Query = root };

var options = new SchemaPrinterOptions
{
IncludeDescriptions = true
IncludeDescriptions = true,
IncludeAllTypes = true
};

var expected = new Dictionary<string, string>
Expand Down Expand Up @@ -298,12 +299,13 @@ public void prints_object_field_with_field_descriptions_and_deprecation_reasons(
var root = new ObjectGraphType { Name = "Query" };
root.Field<FooType>("foo");

var schema = new Schema {Query = root};
var schema = new Schema { Query = root };

var options = new SchemaPrinterOptions
{
IncludeDescriptions = true,
IncludeDeprecationReasons = true
IncludeDeprecationReasons = true,
IncludeAllTypes = true
};

var expected = new Dictionary<string, string>
Expand Down Expand Up @@ -620,57 +622,15 @@ interface Baaz {
str: String
}

scalar BigInt

scalar Byte

# The `Date` scalar type represents a year, month and day in accordance with the
# [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
scalar Date

# The `DateTime` scalar type represents a date and time. `DateTime` expects
# timestamps to be formatted in accordance with the
# [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
scalar DateTime

# The `DateTimeOffset` scalar type represents a date, time and offset from UTC.
# `DateTimeOffset` expects timestamps to be formatted in accordance with the
# [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
scalar DateTimeOffset

scalar Decimal

scalar Guid

# This is a Foo interface type
interface IFoo {
# This is of type String
str: String
}

scalar Long

# The `Milliseconds` scalar type represents a period of time represented as the total number of milliseconds.
scalar Milliseconds

type Query {
bar: Bar
}

scalar SByte

# The `Seconds` scalar type represents a period of time represented as the total number of seconds.
scalar Seconds

scalar Short

scalar UInt

scalar ULong

scalar UShort

scalar Uri
", excludeScalars: true);
}

Expand Down Expand Up @@ -700,57 +660,15 @@ interface Baaz {
str: String
}

scalar BigInt

scalar Byte

# The `Date` scalar type represents a year, month and day in accordance with the
# [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
scalar Date

# The `DateTime` scalar type represents a date and time. `DateTime` expects
# timestamps to be formatted in accordance with the
# [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
scalar DateTime

# The `DateTimeOffset` scalar type represents a date, time and offset from UTC.
# `DateTimeOffset` expects timestamps to be formatted in accordance with the
# [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
scalar DateTimeOffset

scalar Decimal

scalar Guid

# This is a Foo interface type
interface IFoo {
# This is of type String
str: String
}

scalar Long

# The `Milliseconds` scalar type represents a period of time represented as the total number of milliseconds.
scalar Milliseconds

type Query {
bar: Bar
}

scalar SByte

# The `Seconds` scalar type represents a period of time represented as the total number of seconds.
scalar Seconds

scalar Short

scalar UInt

scalar ULong

scalar UShort

scalar Uri
", excludeScalars: true);
}

Expand Down