Class JsonSubTypesResolver
- java.lang.Object
-
- com.github.victools.jsonschema.module.jackson.JsonSubTypesResolver
-
- All Implemented Interfaces:
CustomDefinitionProviderV2,SubtypeResolver
public class JsonSubTypesResolver extends Object implements SubtypeResolver, CustomDefinitionProviderV2
Look-up of subtypes from aJsonSubTypesannotation.
-
-
Constructor Summary
Constructors Constructor Description JsonSubTypesResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<com.fasterxml.classmate.ResolvedType>findSubtypes(com.fasterxml.classmate.ResolvedType declaredType, SchemaGenerationContext context)List<com.fasterxml.classmate.ResolvedType>findTargetTypeOverrides(MemberScope<?,?> property)Look-up applicable subtypes for the given field/method if there is aJsonSubTypesannotation.List<com.fasterxml.classmate.ResolvedType>lookUpSubtypesFromAnnotation(com.fasterxml.classmate.ResolvedType declaredType, com.fasterxml.jackson.annotation.JsonSubTypes subtypesAnnotation, TypeContext context)Mapping the declared erased types from the annotation to resolved types.CustomPropertyDefinitionprovideCustomPropertySchemaDefinition(MemberScope<?,?> scope, SchemaGenerationContext context)Providing custom schema definition for field/method in case of a per-property override of the applicable subtypes or how they are serialized.CustomDefinitionprovideCustomSchemaDefinition(com.fasterxml.classmate.ResolvedType javaType, SchemaGenerationContext context)
-
-
-
Method Detail
-
findSubtypes
public List<com.fasterxml.classmate.ResolvedType> findSubtypes(com.fasterxml.classmate.ResolvedType declaredType, SchemaGenerationContext context)
- Specified by:
findSubtypesin interfaceSubtypeResolver
-
findTargetTypeOverrides
public List<com.fasterxml.classmate.ResolvedType> findTargetTypeOverrides(MemberScope<?,?> property)
Look-up applicable subtypes for the given field/method if there is aJsonSubTypesannotation.- Parameters:
property- targeted field/method- Returns:
- list of annotated subtypes (or
nullif there is noJsonSubTypesannotation)
-
lookUpSubtypesFromAnnotation
public List<com.fasterxml.classmate.ResolvedType> lookUpSubtypesFromAnnotation(com.fasterxml.classmate.ResolvedType declaredType, com.fasterxml.jackson.annotation.JsonSubTypes subtypesAnnotation, TypeContext context)
Mapping the declared erased types from the annotation to resolved types. Returnsnullif annotation isnull/not present.- Parameters:
declaredType- supertype encountered while generating a schemasubtypesAnnotation- annotation to derive applicable subtypes from.context- type context for proper type resolution- Returns:
- resolved annotated subtypes (or
nullif given annotation isnull)
-
provideCustomSchemaDefinition
public CustomDefinition provideCustomSchemaDefinition(com.fasterxml.classmate.ResolvedType javaType, SchemaGenerationContext context)
- Specified by:
provideCustomSchemaDefinitionin interfaceCustomDefinitionProviderV2
-
provideCustomPropertySchemaDefinition
public CustomPropertyDefinition provideCustomPropertySchemaDefinition(MemberScope<?,?> scope, SchemaGenerationContext context)
Providing custom schema definition for field/method in case of a per-property override of the applicable subtypes or how they are serialized.- Parameters:
scope- targeted field or methodcontext- generation context- Returns:
- applicable custom per-property override schema definition (may be
null)
-
-