Class NameValidation

    • Constructor Detail

      • NameValidation

        public NameValidation()
    • Method Detail

      • 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:
        https://spec.graphql.org/draft/#sec-Language.Fragments
      • 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