Class JsonIdentityReferenceDefinitionProvider

java.lang.Object
com.github.victools.jsonschema.module.jackson.JsonIdentityReferenceDefinitionProvider
All Implemented Interfaces:
com.github.victools.jsonschema.generator.CustomDefinitionProviderV2, com.github.victools.jsonschema.generator.StatefulConfig

public class JsonIdentityReferenceDefinitionProvider extends Object implements com.github.victools.jsonschema.generator.CustomDefinitionProviderV2
Implementation of the CustomDefinitionProviderV2 interface for handling types with the @JsonIdentityReference(alwaysAsid = true) identityReferenceAnnotation.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<com.fasterxml.classmate.ResolvedType>
    getIdentityReferenceType(com.fasterxml.classmate.ResolvedType javaType, com.github.victools.jsonschema.generator.TypeContext typeContext)
    If applicable, determine the type of the identity reference that should replace the given actual type, if the @JsonIdentityReference(alwaysAsId = true) annotation is present as well as a corresponding @JsonIdentityInfo annotation on the type itself.
    Optional<com.fasterxml.classmate.ResolvedType>
    getIdentityReferenceType(com.github.victools.jsonschema.generator.MemberScope<?,?> scope)
    If applicable, determine the type of the identity reference that should replace the given field/method's type, if the @JsonIdentityReference(alwaysAsId = true) annotation is present as well as a corresponding @JsonIdentityInfo annotation on the type itself.
    com.github.victools.jsonschema.generator.CustomPropertyDefinition
    provideCustomPropertySchemaDefinition(com.github.victools.jsonschema.generator.MemberScope<?,?> scope, com.github.victools.jsonschema.generator.SchemaGenerationContext context)
    Implementation of the CustomPropertyDefinitionProvider interface that can be used for both fields and methods.
    com.github.victools.jsonschema.generator.CustomDefinition
    provideCustomSchemaDefinition(com.fasterxml.classmate.ResolvedType javaType, com.github.victools.jsonschema.generator.SchemaGenerationContext context)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.github.victools.jsonschema.generator.StatefulConfig

    resetAfterSchemaGenerationFinished
  • Constructor Details

    • JsonIdentityReferenceDefinitionProvider

      public JsonIdentityReferenceDefinitionProvider()
  • Method Details

    • provideCustomSchemaDefinition

      public com.github.victools.jsonschema.generator.CustomDefinition provideCustomSchemaDefinition(com.fasterxml.classmate.ResolvedType javaType, com.github.victools.jsonschema.generator.SchemaGenerationContext context)
      Specified by:
      provideCustomSchemaDefinition in interface com.github.victools.jsonschema.generator.CustomDefinitionProviderV2
    • provideCustomPropertySchemaDefinition

      public com.github.victools.jsonschema.generator.CustomPropertyDefinition provideCustomPropertySchemaDefinition(com.github.victools.jsonschema.generator.MemberScope<?,?> scope, com.github.victools.jsonschema.generator.SchemaGenerationContext context)
      Implementation of the CustomPropertyDefinitionProvider interface that can be used for both fields and methods.
      Parameters:
      scope - field/method on which to check for the @JsonIdentityReference annotation
      context - generation context enabling the standard schema generation for the identity property's value type
      Returns:
      created custom definition (may be null)
    • getIdentityReferenceType

      public Optional<com.fasterxml.classmate.ResolvedType> getIdentityReferenceType(com.fasterxml.classmate.ResolvedType javaType, com.github.victools.jsonschema.generator.TypeContext typeContext)
      If applicable, determine the type of the identity reference that should replace the given actual type, if the @JsonIdentityReference(alwaysAsId = true) annotation is present as well as a corresponding @JsonIdentityInfo annotation on the type itself.
      Parameters:
      javaType - reference type that may be replaced by a reference to its identity property
      typeContext - type context providing convenience methods, e.g., for the annotation or member look-up
      Returns:
      designated type of the applicable identity reference (may be empty)
    • getIdentityReferenceType

      public Optional<com.fasterxml.classmate.ResolvedType> getIdentityReferenceType(com.github.victools.jsonschema.generator.MemberScope<?,?> scope)
      If applicable, determine the type of the identity reference that should replace the given field/method's type, if the @JsonIdentityReference(alwaysAsId = true) annotation is present as well as a corresponding @JsonIdentityInfo annotation on the type itself.
      Parameters:
      scope - field/method that may be replaced by a reference to its identity property
      Returns:
      designated type of the applicable identity reference (may be empty)