Skip to content

Commit e16db8b

Browse files
authored
Merge pull request #2917 from graphql-java/auf-deutsch
Add German validation, parser, and scalar errors
2 parents df2a717 + 04215b5 commit e16db8b

8 files changed

Lines changed: 182 additions & 9 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Thanks for contributing to graphql-java!
22

33

44
Please be sure that you read the [Code of Conduct](CODE_OF_CONDUCT.md) before contributing to this project and please
5-
create a new Issue and discuss first what your are planning to do for bigger changes.
5+
create a new Issue and discuss first what you are planning to do for larger changes.
66

77

88
The overall goal of graphql-java is to have a correct implementation of the [GraphQL Spec](https://github.com/facebook/graphql/) in a production ready way.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# This resource bundle is used for the query parsing code to produce i18n messages
3+
#
4+
# The keys have the format of rule class name and then message type within that. Most rules
5+
# will only have 1 or 2 message keys
6+
#
7+
# Please try and keep this sorted within rule class and use # between sections so the IDEA Ctrl-Alt-L reformat does not bunch
8+
# them too tightly.
9+
#
10+
# REMEMBER - a single quote ' in MessageFormat means things that are never replaced within them
11+
# so use 2 '' characters to make it one ' on output. This will take for the form ''{0}''
12+
#
13+
# Prior to Java 9, properties files are encoded in ISO-8859-1.
14+
# We have to use \u00fc instead of the German ue character, \u00e4 for ae, \u00f6 for oe, \u00df for ss
15+
#
16+
InvalidSyntax.noMessage=Ung\u00fcltige Syntax in Zeile {0} Spalte {1}
17+
InvalidSyntax.full=Ung\u00fcltige Syntax, ANTLR-Fehler ''{0}'' in Zeile {1} Spalte {2}
18+
19+
InvalidSyntaxBail.noToken=Ung\u00fcltige Syntax in Zeile {0} Spalte {1}
20+
InvalidSyntaxBail.full=Ung\u00fcltige Syntax wegen des ung\u00fcltigen Tokens ''{0}'' in Zeile {1} Spalte {2}
21+
#
22+
InvalidSyntaxMoreTokens.full=Es wurde eine ung\u00fcltige Syntax festgestellt. Es gibt zus\u00e4tzliche Token im Text, die nicht konsumiert wurden. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}
23+
#
24+
ParseCancelled.full=Es wurden mehr als {0} ''{1}'' Token pr\u00e4sentiert. Um Denial-of-Service-Angriffe zu verhindern, wurde das Parsing abgebrochen
25+
#
26+
InvalidUnicode.trailingLeadingSurrogate=Ung\u00fcltiger Unicode gefunden. Trailing surrogate muss ein leading surrogate vorangestellt werden. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}
27+
InvalidUnicode.leadingTrailingSurrogate=Ung\u00fcltiger Unicode gefunden. Auf ein leading surrogate muss ein trailing surrogate folgen. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}
28+
InvalidUnicode.invalidCodePoint=Ung\u00fcltiger Unicode gefunden. Kein g\u00fcltiger code point. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}
29+
InvalidUnicode.incorrectEscape=Ung\u00fcltiger Unicode gefunden. Falsch formatierte Escape-Sequenz. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}

‎src/main/resources/i18n/Scalars.properties‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010
# REMEMBER - a single quote ' in MessageFormat means things that are never replaced within them
1111
# so use 2 '' characters to make it one ' on output. This will take for the form ''{0}''
1212
#
13-
Scalar.unexpectedAstType=Expected an AST type of ''{0}'' but it was a ''{1}''.
13+
Scalar.unexpectedAstType=Expected an AST type of ''{0}'' but it was a ''{1}''
1414
#
15-
Enum.badInput=Invalid input for enum ''{0}''. Unknown value ''{1}''.
15+
Enum.badInput=Invalid input for enum ''{0}''. Unknown value ''{1}''
1616
Enum.badName=Invalid input for enum ''{0}''. No value found for name ''{1}''
17-
Enum.unallowableValue=Literal value not in allowable values for enum ''{0}'' - ''{1}''.
17+
Enum.unallowableValue=Literal value not in allowable values for enum ''{0}'' - ''{1}''
1818
#
1919
Int.notInt=Expected a value that can be converted to type ''Int'' but it was a ''{0}''
2020
Int.outsideRange=Expected value to be in the integer range, but it was a ''{0}''
2121
#
2222
ID.notId=Expected a value that can be converted to type ''ID'' but it was a ''{0}''
23-
ID.unexpectedAstType=Expected an AST type of ''IntValue'' or ''StringValue'' but it was a ''{0}''.
23+
ID.unexpectedAstType=Expected an AST type of ''IntValue'' or ''StringValue'' but it was a ''{0}''
2424
#
2525
Float.notFloat=Expected a value that can be converted to type ''Float'' but it was a ''{0}''
26-
Float.unexpectedAstType=Expected an AST type of ''IntValue'' or ''FloatValue'' but it was a ''{0}''.
26+
Float.unexpectedAstType=Expected an AST type of ''IntValue'' or ''FloatValue'' but it was a ''{0}''
2727
#
2828
Boolean.notBoolean=Expected a value that can be converted to type ''Boolean'' but it was a ''{0}''
29-
Boolean.unexpectedAstType=Expected an AST type of ''BooleanValue'' but it was a ''{0}''.
29+
Boolean.unexpectedAstType=Expected an AST type of ''BooleanValue'' but it was a ''{0}''
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# This resource bundle is used for the scalar code to produce i18n messages
3+
#
4+
# The keys have the format of rule class name and then message type within that. Most rules
5+
# will only have 1 or 2 message keys
6+
#
7+
# Please try and keep this sorted within rule class and use # between sections so the IDEA Ctrl-Alt-L reformat does not bunch
8+
# them too tightly.
9+
#
10+
# REMEMBER - a single quote ' in MessageFormat means things that are never replaced within them
11+
# so use 2 '' characters to make it one ' on output. This will take for the form ''{0}''
12+
#
13+
# Prior to Java 9, properties files are encoded in ISO-8859-1.
14+
# We have to use \u00fc instead of the German ue character, \u00e4 for ae, \u00f6 for oe, \u00df for ss
15+
#
16+
Scalar.unexpectedAstType=Erwartet wurde ein AST type von ''{0}'', aber es war ein ''{1}''
17+
#
18+
Enum.badInput=Ung\u00fcltige Eingabe f\u00fcr enum ''{0}''. Unbekannter Wert ''{1}''
19+
Enum.badName=Ung\u00fcltige Eingabe f\u00fcr enum ''{0}''. Kein Wert f\u00fcr den Namen ''{1}'' gefunden
20+
Enum.unallowableValue=Literal nicht in den zul\u00e4ssigen Werten f\u00fcr enum ''{0}'' - ''{1}''
21+
#
22+
Int.notInt=Erwartet wurde ein Wert, der in den Typ ''Int'' konvertiert werden kann, aber es war ein ''{0}''
23+
Int.outsideRange=Erwarteter Wert im Integer-Bereich, aber es war ein ''{0}''
24+
#
25+
ID.notId=Erwartet wurde ein Wert, der in den Typ ''ID'' umgewandelt werden kann, aber es war ein ''{0}''
26+
ID.unexpectedAstType=Erwartet wurde ein AST type von ''IntValue'' oder ''StringValue'', aber es war ein ''{0}''
27+
#
28+
Float.notFloat=Erwartet wurde ein Wert, der in den Typ ''Float'' konvertiert werden kann, aber es war ein ''{0}''
29+
Float.unexpectedAstType=Erwartet wurde ein AST type von ''IntValue'' oder ''FloatValue'', aber es war ein ''{0}''
30+
#
31+
Boolean.notBoolean=Erwartet wurde ein Wert, der in den Typ ''Boolean'' konvertiert werden kann, aber es war ein ''{0}''
32+
Boolean.unexpectedAstType=Erwartet wurde ein AST type ''BooleanValue'', aber es war ein ''{0}''

‎src/main/resources/i18n/Validation.properties‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ VariableTypesMatchRule.unexpectedType=Validation error ({0}) : Variable type ''{
8484
ArgumentValidationUtil.handleNullError=Validation error ({0}) : argument ''{1}'' with value ''{2}'' must not be null
8585
# suppress inspection "UnusedProperty"
8686
ArgumentValidationUtil.handleScalarError=Validation error ({0}) : argument ''{1}'' with value ''{2}'' is not a valid ''{3}''
87+
# suppress inspection "UnusedProperty"
8788
ArgumentValidationUtil.handleScalarErrorCustomMessage=Validation error ({0}) : argument ''{1}'' with value ''{2}'' is not a valid ''{3}'' - {4}
8889
# suppress inspection "UnusedProperty"
8990
ArgumentValidationUtil.handleEnumError=Validation error ({0}) : argument ''{1}'' with value ''{2}'' is not a valid ''{3}''
91+
# suppress inspection "UnusedProperty"
9092
ArgumentValidationUtil.handleEnumErrorCustomMessage=Validation error ({0}) : argument ''{1}'' with value ''{2}'' is not a valid ''{3}'' - {4}
9193
# suppress inspection "UnusedProperty"
9294
ArgumentValidationUtil.handleNotObjectError=Validation error ({0}) : argument ''{1}'' with value ''{2}'' must be an object type
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#
2+
# This resource bundle is used for the query validation code to produce i18n messages
3+
#
4+
# The keys have the format of rule class name and then message type within that. Most rules
5+
# will only have 1 or 2 message keys
6+
#
7+
# Please try and keep this sorted within rule class and use # between sections so the IDEA Ctrl-Alt-L reformat does not bunch
8+
# them too tightly.
9+
#
10+
# REMEMBER - a single quote ' in MessageFormat means things that are never replaced within them
11+
# so use 2 '' characters to make it one ' on output. This will take for the form ''{0}''
12+
#
13+
# Prior to Java 9, properties files are encoded in ISO-8859-1.
14+
# We have to use \u00fc instead of the German ue character, \u00e4 for ae, \u00f6 for oe, \u00df for ss
15+
#
16+
ExecutableDefinitions.notExecutableType=Validierungsfehler ({0}) : Type definition ''{1}'' ist nicht ausf\u00fchrbar
17+
ExecutableDefinitions.notExecutableSchema=Validierungsfehler ({0}) : Schema definition ist nicht ausf\u00fchrbar
18+
ExecutableDefinitions.notExecutableDirective=Validierungsfehler ({0}) : Directive definition ''{1}'' ist nicht ausf\u00fchrbar
19+
ExecutableDefinitions.notExecutableDefinition=Validierungsfehler ({0}) : Die angegebene Definition ist nicht ausf\u00fchrbar
20+
#
21+
FieldsOnCorrectType.unknownField=Validierungsfehler ({0}) : Feld ''{1}'' vom Typ ''{2}'' ist nicht definiert
22+
#
23+
FragmentsOnCompositeType.invalidInlineTypeCondition=Validierungsfehler ({0}) : Inline fragment type condition ist ung\u00fcltig, muss auf Object/Interface/Union stehen
24+
FragmentsOnCompositeType.invalidFragmentTypeCondition=Validierungsfehler ({0}) : Fragment type condition ist ung\u00fcltig, muss auf Object/Interface/Union stehen
25+
#
26+
KnownArgumentNames.unknownDirectiveArg=Validierungsfehler ({0}) : Unbekanntes directive argument ''{1}''
27+
KnownArgumentNames.unknownFieldArg=Validierungsfehler ({0}) : Unbekanntes field argument ''{1}''
28+
#
29+
KnownDirectives.unknownDirective=Validierungsfehler ({0}) : Unbekannte directive ''{1}''
30+
KnownDirectives.directiveNotAllowed=Validierungsfehler ({0}) : Directive ''{1}'' ist hier nicht erlaubt
31+
#
32+
KnownFragmentNames.undefinedFragment=Validierungsfehler ({0}) : Undefiniertes Fragment ''{1}''
33+
#
34+
KnownTypeNames.unknownType=Validierungsfehler ({0}) : Unbekannter Typ ''{1}''
35+
#
36+
LoneAnonymousOperation.withOthers=Validierungsfehler ({0}) : Anonyme Operation mit anderen Operationen
37+
LoneAnonymousOperation.namedOperation=Validierungsfehler ({0}) : Operation ''{1}'' folgt der anonymen Operation
38+
#
39+
NoFragmentCycles.cyclesNotAllowed=Validierungsfehler ({0}) : Fragment cycles nicht erlaubt
40+
#
41+
NoUndefinedVariables.undefinedVariable=Validierungsfehler ({0}) : Undefinierte Variable ''{1}''
42+
#
43+
NoUnusedFragments.unusedFragments=Validierungsfehler ({0}) : Unbenutztes Fragment ''{1}''
44+
#
45+
NoUnusedVariables.unusedVariable=Validierungsfehler ({0}) : Unbenutzte Variable ''{1}''
46+
#
47+
OverlappingFieldsCanBeMerged.differentFields=Validierungsfehler ({0}) : ''{1}'' : ''{2}'' und ''{3}'' sind unterschiedliche Felder
48+
OverlappingFieldsCanBeMerged.differentArgs=Validierungsfehler ({0}) : ''{1}'' : Felder haben unterschiedliche Argumente
49+
OverlappingFieldsCanBeMerged.differentNullability=Validierungsfehler ({0}) : ''{1}'' : Felder haben unterschiedliche nullability shapes
50+
OverlappingFieldsCanBeMerged.differentLists=Validierungsfehler ({0}) : ''{1}'' : Felder haben unterschiedliche list shapes
51+
OverlappingFieldsCanBeMerged.differentReturnTypes=Validierungsfehler ({0}) : ''{1}'' : gibt verschiedene Typen ''{2}'' und ''{3}'' zur\u00fcck
52+
#
53+
PossibleFragmentSpreads.inlineIncompatibleTypes=Validierungsfehler ({0}) : Fragment kann hier nicht verbreitet werden, da object vom Typ ''{1}'' niemals vom Typ ''{2}'' sein k\u00f6nnen
54+
PossibleFragmentSpreads.fragmentIncompatibleTypes=Validierungsfehler ({0}) : Fragment ''{1}'' kann hier nicht verbreitet werden, da object vom Typ ''{2}'' niemals vom Typ ''{3}'' sein k\u00f6nnen
55+
#
56+
ProvidedNonNullArguments.missingFieldArg=Validierungsfehler ({0}) : Fehlendes field argument ''{1}''
57+
ProvidedNonNullArguments.missingDirectiveArg=Validierungsfehler ({0}) : Fehlendes directive argument ''{1}''
58+
ProvidedNonNullArguments.nullValue=Validierungsfehler ({0}) : Nullwert f\u00fcr non-null field argument ''{1}''
59+
#
60+
ScalarLeaves.subselectionOnLeaf=Validierungsfehler ({0}) : Unterauswahl f\u00fcr Blatttyp ''{1}'' von Feld ''{2}'' nicht zul\u00e4ssig
61+
ScalarLeaves.subselectionRequired=Validierungsfehler ({0}) : Unterauswahl erforderlich f\u00fcr Typ ''{1}'' des Feldes ''{2}''
62+
#
63+
SubscriptionUniqueRootField.multipleRootFields=Validierungsfehler ({0}) : Subscription operation ''{1}'' muss genau ein root field haben
64+
SubscriptionUniqueRootField.multipleRootFieldsWithFragment=Validierungsfehler ({0}) : Subscription operation ''{1}'' muss genau ein root field mit Fragmenten haben
65+
SubscriptionIntrospectionRootField.introspectionRootField=Validierungsfehler ({0}) : Subscription operation ''{1}'' root field ''{2}'' kann kein introspection field sein
66+
SubscriptionIntrospectionRootField.introspectionRootFieldWithFragment=Validierungsfehler ({0}) : Subscription operation ''{1}'' fragment root field ''{2}'' kann kein introspection field sein
67+
#
68+
UniqueArgumentNames.uniqueArgument=Validierungsfehler ({0}) : Es kann nur ein Argument namens ''{1}'' geben
69+
#
70+
UniqueDirectiveNamesPerLocation.uniqueDirectives=Validierungsfehler ({0}) : Nicht wiederholbare directive m\u00fcssen innerhalb einer Lokation eindeutig benannt werden. Directive ''{1}'', die auf einem ''{2}'' verwendet wird, ist nicht eindeutig
71+
#
72+
UniqueFragmentNames.oneFragment=Validierungsfehler ({0}) : Es kann nur ein Fragment namens ''{1}'' geben
73+
#
74+
UniqueOperationNames.oneOperation=Validierungsfehler ({0}) : Es kann nur eine Operation namens ''{1}'' geben
75+
#
76+
UniqueVariableNames.oneVariable=Validierungsfehler ({0}) : Es kann nur eine Variable namens ''{1}'' geben
77+
#
78+
VariableDefaultValuesOfCorrectType.badDefault=Validierungsfehler ({0}) : Ung\u00fcltiger Standardwert ''{1}'' f\u00fcr Typ ''{2}''
79+
#
80+
VariablesAreInputTypes.wrongType=Validierungsfehler ({0}) : Eingabevariable ''{1}'' Typ ''{2}'' ist kein Eingabetyp
81+
#
82+
VariableTypesMatchRule.unexpectedType=Validierungsfehler ({0}) : Der Variablentyp ''{1}'' stimmt nicht mit dem erwarteten Typ ''{2}'' \u00fcberein
83+
#
84+
# These are used but IDEA cant find them easily as being called
85+
#
86+
# suppress inspection "UnusedProperty"
87+
ArgumentValidationUtil.handleNullError=Validierungsfehler ({0}) : Argument ''{1}'' mit Wert ''{2}'' darf nicht null sein
88+
# suppress inspection "UnusedProperty"
89+
ArgumentValidationUtil.handleScalarError=Validierungsfehler ({0}) : Argument ''{1}'' mit Wert ''{2}'' ist kein g\u00fcltiges ''{3}''
90+
# suppress inspection "UnusedProperty"
91+
ArgumentValidationUtil.handleScalarErrorCustomMessage=Validierungsfehler ({0}) : Argument ''{1}'' mit Wert ''{2}'' ist kein g\u00fcltiges ''{3}'' - {4}
92+
# suppress inspection "UnusedProperty"
93+
ArgumentValidationUtil.handleEnumError=Validierungsfehler ({0}) : Argument ''{1}'' mit Wert ''{2}'' ist kein g\u00fcltiges ''{3}''
94+
# suppress inspection "UnusedProperty"
95+
ArgumentValidationUtil.handleEnumErrorCustomMessage=Validierungsfehler ({0}) : Argument ''{1}'' mit Wert ''{2}'' ist kein g\u00fcltiges ''{3}'' - {4}
96+
# suppress inspection "UnusedProperty"
97+
ArgumentValidationUtil.handleNotObjectError=Validierungsfehler ({0}) : Argument ''{1}'' mit Wert ''{2}'' muss ein object type sein
98+
# suppress inspection "UnusedProperty"
99+
ArgumentValidationUtil.handleMissingFieldsError=Validierungsfehler ({0}) : Argument ''{1}'' mit Wert ''{2}'' fehlen Pflichtfelder ''{3}''
100+
# suppress inspection "UnusedProperty"
101+
ArgumentValidationUtil.handleExtraFieldError=Validierungsfehler ({0}) : Argument ''{1}'' mit Wert ''{2}'' enth\u00e4lt ein Feld nicht in ''{3}'': ''{4}''
102+
#

‎src/test/groovy/graphql/i18n/I18nTest.groovy‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ class I18nTest extends Specification {
2626
}
2727
}
2828

29+
def "A non-default bundle can be read"() {
30+
def i18n = I18n.i18n(BundleType.Validation, Locale.GERMAN)
31+
when:
32+
def message = i18n.msg("ExecutableDefinitions.notExecutableType")
33+
then:
34+
message == "Validierungsfehler ({0}) : Type definition '{1}' ist nicht ausführbar"
35+
}
36+
2937
static def assertBundleStaticShape(ResourceBundle bundle) {
3038
def enumeration = bundle.getKeys()
3139
while (enumeration.hasMoreElements()) {

‎src/test/groovy/graphql/validation/rules/ArgumentsOfCorrectTypeTest.groovy‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class ArgumentsOfCorrectTypeTest extends Specification {
8080
!validationErrors.empty
8181
validationErrors.size() == 1
8282
validationErrors.get(0).getValidationErrorType() == ValidationErrorType.WrongType
83-
validationErrors.get(0).message == "Validation error (WrongType@[dog]) : argument 'arg1' with value 'IntValue{value=1}' is not a valid 'String' - Expected an AST type of 'StringValue' but it was a 'IntValue'."
83+
validationErrors.get(0).message == "Validation error (WrongType@[dog]) : argument 'arg1' with value 'IntValue{value=1}' is not a valid 'String' - Expected an AST type of 'StringValue' but it was a 'IntValue'"
8484
}
8585

8686
def "invalid input object type results in error"() {
@@ -332,7 +332,7 @@ class ArgumentsOfCorrectTypeTest extends Specification {
332332
!validationErrors.empty
333333
validationErrors.size() == 1
334334
validationErrors.get(0).getValidationErrorType() == ValidationErrorType.WrongType
335-
validationErrors.get(0).message == "Validation error (WrongType@[dog/doesKnowCommand]) : argument 'dogCommand' with value 'EnumValue{name='PRETTY'}' is not a valid 'DogCommand' - Literal value not in allowable values for enum 'DogCommand' - 'EnumValue{name='PRETTY'}'."
335+
validationErrors.get(0).message == "Validation error (WrongType@[dog/doesKnowCommand]) : argument 'dogCommand' with value 'EnumValue{name='PRETTY'}' is not a valid 'DogCommand' - Literal value not in allowable values for enum 'DogCommand' - 'EnumValue{name='PRETTY'}'"
336336
}
337337

338338
static List<ValidationError> validate(String query) {

0 commit comments

Comments
 (0)