Package io.micronaut.openapi.visitor
Class Utils
java.lang.Object
io.micronaut.openapi.visitor.Utils
Some util methods.
- Since:
- 4.4.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clean()
static <T> List<T>
findAndRemoveDuplicates
(List<T> elements, BiPredicate<T, T> predicate) Find and remove duplicates in lists.static Map<String,
List<EndpointInfo>> static JavadocParser
static com.fasterxml.jackson.databind.ObjectMapper
static io.micronaut.http.MediaType
getMediaType
(String mediaTypeName) Get or create MediaType object by name.static String
static String
static io.swagger.v3.oas.models.OpenAPI
static Map<Pair<String,
String>, OpenApiInfo> static String
static com.fasterxml.jackson.databind.ObjectMapper
static void
init
(io.micronaut.inject.visitor.VisitorContext context) static boolean
static boolean
static <T extends Enum<T>>
voidnormalizeEnumValues
(Map<CharSequence, Object> paramValues, Map<String, Class<T>> enumTypes) Normalizes enum values stored in the map.static String
Return stacktrace for throwable and message.static io.swagger.v3.oas.models.Components
resolveComponents
(io.swagger.v3.oas.models.OpenAPI openApi) Resolve the components.static io.swagger.v3.oas.models.OpenAPI
resolveOpenApi
(io.micronaut.inject.visitor.VisitorContext context) Resolve theOpenAPI
instance.static List<io.swagger.v3.oas.models.tags.Tag>
resolveTags
(io.swagger.v3.oas.models.OpenAPI openApi) Resolve tags.resolveWebhooks
(io.swagger.v3.oas.models.OpenAPI openApi) Resolve the webhooks.static void
setAllKnownGroups
(Set<String> allKnownGroups) static void
setAllKnownVersions
(Set<String> allKnownVersions) static void
setEndpointInfos
(Map<String, List<EndpointInfo>> endpointInfos) static void
setIncludedClassesGroups
(Map<String, List<String>> includedClassesGroups) static void
setIncludedClassesGroupsExcluded
(Map<String, List<String>> includedClassesGroupsExcluded) static void
setJavadocParser
(JavadocParser javadocParser) static void
setOpenapi31
(boolean openapi31) static void
setOpenApis
(Map<String, io.swagger.v3.oas.models.OpenAPI> openApis) static void
setTestFileName
(String testFileName) static void
setTestJsonReference
(String testJsonReference) static void
setTestReference
(io.swagger.v3.oas.models.OpenAPI testReference) static void
setTestReferences
(Map<Pair<String, String>, OpenApiInfo> testReferences) static void
setTestYamlReference
(String testYamlReference)
-
Field Details
-
ATTR_OPENAPI
- See Also:
-
ATTR_TEST_MODE
- See Also:
-
ATTR_VISITED_ELEMENTS
- See Also:
-
DEFAULT_MEDIA_TYPES
-
-
Method Details
-
init
public static void init(io.micronaut.inject.visitor.VisitorContext context) -
getMediaType
Get or create MediaType object by name.- Parameters:
mediaTypeName
- name of mediaType- Returns:
- MediaType object
-
normalizeEnumValues
public static <T extends Enum<T>> void normalizeEnumValues(Map<CharSequence, Object> paramValues, Map<String, Class<T>> enumTypes) Normalizes enum values stored in the map.- Type Parameters:
T
- enum class- Parameters:
paramValues
- The valuesenumTypes
- The enum types.
-
findAndRemoveDuplicates
Find and remove duplicates in lists.- Type Parameters:
T
- elements class- Parameters:
elements
- list of elementspredicate
- predicate for calculating duplicate element- Returns:
- list of elements without duplicates
-
resolveComponents
public static io.swagger.v3.oas.models.Components resolveComponents(io.swagger.v3.oas.models.OpenAPI openApi) Resolve the components.- Parameters:
openApi
- The open API- Returns:
- The components
-
resolveWebhooks
public static Map<String,io.swagger.v3.oas.models.PathItem> resolveWebhooks(io.swagger.v3.oas.models.OpenAPI openApi) Resolve the webhooks.- Parameters:
openApi
- The open API- Returns:
- The webhooks
-
resolveTags
public static List<io.swagger.v3.oas.models.tags.Tag> resolveTags(io.swagger.v3.oas.models.OpenAPI openApi) Resolve tags.- Parameters:
openApi
- The open API- Returns:
- The tags
-
resolveOpenApi
public static io.swagger.v3.oas.models.OpenAPI resolveOpenApi(io.micronaut.inject.visitor.VisitorContext context) Resolve theOpenAPI
instance.- Parameters:
context
- The context- Returns:
- The
OpenAPI
instance
-
printStackTrace
Return stacktrace for throwable and message.- Parameters:
t
- throwable- Returns:
- stacktrace
-
isTestMode
public static boolean isTestMode() -
getTestReference
public static io.swagger.v3.oas.models.OpenAPI getTestReference() -
setTestReference
public static void setTestReference(io.swagger.v3.oas.models.OpenAPI testReference) -
getTestReferences
-
setTestReferences
-
getTestYamlReference
-
setTestYamlReference
-
getTestJsonReference
-
getTestFileName
-
setTestFileName
-
setTestJsonReference
-
getJavadocParser
-
setJavadocParser
-
getAllKnownVersions
-
setAllKnownVersions
-
getAllKnownGroups
-
setAllKnownGroups
-
getEndpointInfos
-
setEndpointInfos
-
getOpenApis
-
setOpenApis
-
getIncludedClassesGroups
-
setIncludedClassesGroups
-
getIncludedClassesGroupsExcluded
-
setIncludedClassesGroupsExcluded
-
getCreatorConstructorsCache
-
getJsonMapper
public static com.fasterxml.jackson.databind.ObjectMapper getJsonMapper() -
getYamlMapper
public static com.fasterxml.jackson.databind.ObjectMapper getYamlMapper() -
isOpenapi31
public static boolean isOpenapi31() -
setOpenapi31
public static void setOpenapi31(boolean openapi31) -
clean
public static void clean()
-