Class NameValidation
java.lang.Object
io.smallrye.graphql.client.core.utils.validation.NameValidation
This class provides utility methods for validating names according to the GraphQL specification.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringvalidateFieldName(String fieldName) Validates the given field name, allowing at most one colon that is not at the beginning or end for alias.static StringvalidateFragmentName(String name) Validates a GraphQL fragment name and returns it.static StringvalidateName(String name) Validates a GraphQL name and returns it.static StringvalidateNameAllowEmpty(String name) Validates a GraphQL name and returns it.static StringvalidateTypeName(String typeName)
-
Constructor Details
-
NameValidation
public NameValidation()
-
-
Method Details
-
validateNameAllowEmpty
Validates a GraphQL name and returns it. Throws an IllegalArgumentException if the name is null or invalid. Allows empty string "" as a valid input.- Parameters:
name- the name to validate- Returns:
- the validated name
- Throws:
IllegalArgumentException- if the name is null or invalid
-
validateFragmentName
Validates a GraphQL fragment name and returns it. Throws an IllegalArgumentException if the name is null, invalid or is equal to the reserved word "on".- Parameters:
name- the name to validate- Returns:
- the validated name
- Throws:
IllegalArgumentException- if the name is null, invalid or is equal to the reserved word "on"- See Also:
-
validateName
Validates a GraphQL name and returns it. Throws an IllegalArgumentException if the name is null or invalid. Does not allow empty string "" as a valid input.- Parameters:
name- the name to validate- Returns:
- the validated name
- Throws:
IllegalArgumentException- if the name is null, invalid or empty
-
validateFieldName
Validates the given field name, allowing at most one colon that is not at the beginning or end for alias.- Parameters:
fieldName- the field name to validate- Returns:
- the validated field name
- Throws:
IllegalArgumentException- if the field name is null or invalid- See Also:
-
validateTypeName
-