Package org.openapitools.codegen.utils
Class EnumUtils
- java.lang.Object
-
- org.openapitools.codegen.utils.EnumUtils
-
public class EnumUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description EnumUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Map<String,String>>getBungieEnumValues(List<Map<String,Object>> xEnumValues)Bungie has defined their own enum extension to describe enum values.static List<Object>getEnumValues(Map<String,Object> allowableValues)Get the "values" from the allowableValues map.static List<String>getEnumValuesAsString(Map<String,Object> allowableValues)Get the "values" from the allowableValues map.static List<EnumVarMap>getEnumVars(Map<String,Object> allowableValues)Get the "enumVars" from the allowableValues map.static booleanhasEnumValues(Map<String,Object> allowableValues)static booleanhasEnumVars(Map<String,Object> allowableValues)static io.swagger.v3.oas.models.media.SchemasimplifyComposedSchemaWithEnums(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.
-
-
-
Field Detail
-
BUNGIE_X_ENUM_VALUES
public static final String BUNGIE_X_ENUM_VALUES
- See Also:
- Constant Field Values
-
ONE_OF
public static final String ONE_OF
- See Also:
- Constant Field Values
-
ANY_OF
public static final String ANY_OF
- See Also:
- Constant Field Values
-
-
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 withx-enum-valuesfor more information.- Parameters:
xEnumValues- Thex-enum-valuesBungie extension map- Returns:
- A list of
enumVarsextracted from thex-enum-valuesextension
-
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 modifysubSchemas- List of sub-schemas to checkcomposedType- Type of composed schema ("oneOf" or "anyOf")openAPI- The OpenAPI object to resolve references- Returns:
- Simplified schema
-
-