Skip to content

Commit 1662784

Browse files
authored
Disallowed deprecation of fields not deprecated in the interface (#8279)
1 parent 53acbf8 commit 1662784

File tree

7 files changed

+2063
-998
lines changed

7 files changed

+2063
-998
lines changed

src/HotChocolate/Core/src/Types/Configuration/Validation/TypeValidationHelper.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ private static void ValidateImplementation(
158158
{
159159
errors.Add(InvalidFieldType(type, field, implementedField));
160160
}
161+
162+
if (field.IsDeprecated && !implementedField.IsDeprecated)
163+
{
164+
errors.Add(InvalidFieldDeprecation(
165+
implementedType.Name,
166+
implementedField,
167+
type,
168+
field));
169+
}
161170
}
162171
else
163172
{

src/HotChocolate/Core/src/Types/Extensions/SchemaErrorBuilderExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ public static SchemaErrorBuilder SetMessage(
2323
public static SchemaErrorBuilder SpecifiedBy(
2424
this SchemaErrorBuilder errorBuilder,
2525
string section,
26-
bool condition = true)
26+
bool condition = true,
27+
bool isDraft = false)
2728
{
2829
if (condition)
2930
{
3031
errorBuilder.SetExtension(
3132
"specifiedBy",
32-
"https://spec.graphql.org/October2021/#" + section);
33+
$"https://spec.graphql.org/{(isDraft ? "draft" : "October2021")}/#{section}");
3334
}
3435

3536
return errorBuilder;

0 commit comments

Comments
 (0)