Class NameValidation

java.lang.Object
io.smallrye.graphql.client.core.utils.validation.NameValidation

public class NameValidation extends Object
This class provides utility methods for validating names according to the GraphQL specification.
See Also:
  • Constructor Details

    • NameValidation

      public NameValidation()
  • Method Details

    • validateNameAllowEmpty

      public static String validateNameAllowEmpty(String name)
      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

      public static String validateFragmentName(String name)
      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

      public static String validateName(String name)
      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

      public static String validateFieldName(String fieldName)
      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

      public static String validateTypeName(String typeName)