Class EnumUtils


  • public class EnumUtils
    extends Object
    • Constructor Detail

      • EnumUtils

        public EnumUtils()
    • Method Detail

      • hasEnumVars

        public static boolean hasEnumVars​(Map<String,​Object> allowableValues)
        Parameters:
        allowableValues - The allowableValues map
        Returns:
        whether the allowableValues map contains "enumVars"
      • hasEnumValues

        public static boolean hasEnumValues​(Map<String,​Object> allowableValues)
        Parameters:
        allowableValues - The allowableValues map
        Returns:
        whether the allowableValues map contains "values"
      • getEnumVars

        public static List<EnumVarMap> getEnumVars​(Map<String,​Object> allowableValues)
        Get the "enumVars" from the allowableValues map.
        Parameters:
        allowableValues - The allowableValues map
        Returns:
        the list of enumVars
      • getEnumValues

        public static List<Object> getEnumValues​(Map<String,​Object> allowableValues)
        Get the "values" from the allowableValues map.
        Parameters:
        allowableValues - The allowableValues map
        Returns:
        the list of enumValues
      • getEnumValuesAsString

        public static List<String> getEnumValuesAsString​(Map<String,​Object> allowableValues)
        Get the "values" from the allowableValues map.
        Parameters:
        allowableValues - The allowableValues map
        Returns:
        the list of enumValues
      • getBungieEnumValues

        public static List<Map<String,​String>> getBungieEnumValues​(List<Map<String,​Object>> xEnumValues)
        Bungie has defined their own enum extension to describe enum values. See documentation and the section with x-enum-values for more information.
        Parameters:
        xEnumValues - The x-enum-values Bungie extension map
        Returns:
        A list of enumVars extracted from the x-enum-values extension
      • simplifyComposedSchemaWithEnums

        public static io.swagger.v3.oas.models.media.Schema simplifyComposedSchemaWithEnums​(io.swagger.v3.oas.models.media.Schema schema,
                                                                                            List<Object> subSchemas,
                                                                                            String composedType,
                                                                                            io.swagger.v3.oas.models.OpenAPI openAPI)
        Simplifies a composed schema (oneOf/anyOf) where all sub-schemas are enums to a single enum schema containing all the values.
        Parameters:
        schema - Schema to modify
        subSchemas - List of sub-schemas to check
        composedType - Type of composed schema ("oneOf" or "anyOf")
        openAPI - The OpenAPI object to resolve references
        Returns:
        Simplified schema