Interface SchemaGenerationContext

  • All Known Implementing Classes:
    SchemaGenerationContextImpl

    public interface SchemaGenerationContext
    Generation context for sub-schema definitions.
    • Method Detail

      • getGeneratorConfig

        SchemaGeneratorConfig getGeneratorConfig()
        Getter for the applicable configuration.
        Returns:
        configuration defined for this context
      • getKeyword

        String getKeyword​(SchemaKeyword keyword)
        Look-up a given keyword's associated tag name or value for the designated JSON Schema version.
        Parameters:
        keyword - reference to a tag name or value
        Returns:
        specific tag name or value in the designated JSON Schema version
        See Also:
        SchemaGeneratorConfig.getKeyword(SchemaKeyword)
      • getTypeContext

        TypeContext getTypeContext()
        Getter for the type resolution/introspection context in use.
        Returns:
        type resolution/introspection context
      • createDefinition

        com.fasterxml.jackson.databind.node.ObjectNode createDefinition​(com.fasterxml.classmate.ResolvedType targetType)
        Create an inline definition for the given targetType. Also respecting any custom definition for the given targetType.
        This is equivalent to calling createStandardDefinition(targetType, null)
        Parameters:
        targetType - type to create definition node for
        Returns:
        designated definition node for the targetType
        See Also:
        createDefinitionReference(ResolvedType), createStandardDefinition(ResolvedType, CustomDefinitionProviderV2)
      • createDefinitionReference

        com.fasterxml.jackson.databind.node.ObjectNode createDefinitionReference​(com.fasterxml.classmate.ResolvedType targetType)
        Create a definition for the given targetType. Also respecting any custom definition for the given targetType.
        The returned node will be empty, but is being remembered internally and populated later, i.e. it should not be changed!
        This is equivalent to calling createStandardDefinitionReference(targetType, null)
        Parameters:
        targetType - type to create definition (reference) node for
        Returns:
        (temporarily) empty reference node for the targetType that will only be populated at the very end of the schema generation
        See Also:
        createDefinition(ResolvedType), createStandardDefinitionReference(ResolvedType, CustomDefinitionProviderV2)
      • createStandardDefinition

        com.fasterxml.jackson.databind.JsonNode createStandardDefinition​(MethodScope targetScope,
                                                                         CustomPropertyDefinitionProvider<MethodScope> ignoredDefinitionProvider)
        Create a standard definition for the given property. Ignoring custom definitions up to the given one, but respecting others.
        The returned schema will be inlined and fully populated, i.e. it may be further manipulated - at the risk of an endless loop in case of a circular reference.
        The returned type is always an ObjectNode unless the given method is void, which will result in a BooleanNode.FALSE.
        Parameters:
        targetScope - property to create definition node for
        ignoredDefinitionProvider - custom definition provider to ignore
        Returns:
        inline definition for the given method
        See Also:
        createDefinition(ResolvedType), createStandardDefinitionReference(MethodScope, CustomPropertyDefinitionProvider)
      • createStandardDefinitionReference

        com.fasterxml.jackson.databind.node.ObjectNode createStandardDefinitionReference​(com.fasterxml.classmate.ResolvedType targetType,
                                                                                         CustomDefinitionProviderV2 ignoredDefinitionProvider)
        Create a standard definition for the given targetType. Ignoring custom definitions up to the given one, but respecting others.
        The returned node will be empty, but is being remembered internally and populated later, i.e. it should not be changed!
        Parameters:
        targetType - type to create definition (reference) node for
        ignoredDefinitionProvider - custom definition provider to ignore
        Returns:
        (temporarily) empty reference node for the targetType that will only be populated at the very end of the schema generation
        See Also:
        createDefinitionReference(ResolvedType), createStandardDefinition(ResolvedType, CustomDefinitionProviderV2)
      • createStandardDefinitionReference

        com.fasterxml.jackson.databind.node.ObjectNode createStandardDefinitionReference​(FieldScope targetScope,
                                                                                         CustomPropertyDefinitionProvider<FieldScope> ignoredDefinitionProvider)
        Create a standard definition for the given property. Ignoring custom definitions up to the given one, but respecting others.
        If a specific custom definition for this field is being applied, it will be inlined and fully populated; that may be further manipulated. Otherwise, the returned node will be empty and is populated only later, i.e. it should not be changed in that case!
        Parameters:
        targetScope - property to create definition (reference) node for
        ignoredDefinitionProvider - custom definition provider to ignore
        Returns:
        either custom inline definition for this field or a (temporarily) empty reference node for the targetType that will only be populated at the very end of the schema generation
        See Also:
        createDefinitionReference(ResolvedType), createStandardDefinition(FieldScope, CustomPropertyDefinitionProvider)
      • createStandardDefinitionReference

        com.fasterxml.jackson.databind.JsonNode createStandardDefinitionReference​(MethodScope targetScope,
                                                                                  CustomPropertyDefinitionProvider<MethodScope> ignoredDefinitionProvider)
        Create a standard definition for the given property. Ignoring custom definitions up to the given one, but respecting others.
        If a specific custom definition for this method is being applied, it will be inlined and fully populated; that may be further manipulated. Otherwise, the returned node will be empty and is populated only later, i.e. it should not be changed in that case!
        The returned type is always an ObjectNode unless the given method is void, which will result in a BooleanNode.FALSE.
        Parameters:
        targetScope - property to create definition (reference) node for
        ignoredDefinitionProvider - custom definition provider to ignore
        Returns:
        either custom inline definition for this method or a (temporarily) empty reference node for the targetType that will only be populated at the very end of the schema generation
        See Also:
        createDefinitionReference(ResolvedType), createStandardDefinition(MethodScope, CustomPropertyDefinitionProvider)
      • makeNullable

        com.fasterxml.jackson.databind.node.ObjectNode makeNullable​(com.fasterxml.jackson.databind.node.ObjectNode node)
        Ensure that the JSON schema represented by the given node allows for it to be of "type" "null".
        Parameters:
        node - representation of a JSON schema (part) that should allow a value of "type" "null"
        Returns:
        reference to the given parameter node