private Map.Entry<ObjectNode, Boolean> applyCustomDefinition(CustomDefinition customDefinition, ObjectNode targetNode,
            GenericTypeDetails typeDetails) {
        ResolvedType targetType = typeDetails.getScope().getType();
        if (!typeDetails.isInlineDefinition()) {
            ObjectNode definition = this.generatorConfig.createObjectNode();
            this.putDefinition(targetType, definition, typeDetails.getIgnoredDefinitionProvider());
            this.addReference(targetType, targetNode, typeDetails.getIgnoredDefinitionProvider(), typeDetails.isNullable());
            this.markDefinitionAsNeverInlinedIfRequired(customDefinition, targetType, typeDetails.getIgnoredDefinitionProvider());
            logger.debug("applying configured custom definition for {}", targetType);
            definition.setAll(customDefinition.getValue());
            return new AbstractMap.SimpleEntry<>(definition, customDefinition.shouldIncludeAttributes());
        }
        final ObjectNode definition;
        if (targetNode == null) {
            logger.debug("storing configured custom inline type for {} as definition (since it is the main schema \"#\")", targetType);
            definition = customDefinition.getValue();
            this.putDefinition(targetType, definition, typeDetails.getIgnoredDefinitionProvider());
            // targetNode will be populated at the end, in buildDefinitionsAndResolveReferences()
        } else {
            logger.debug("directly applying configured custom inline type for {}", targetType);
            targetNode.setAll(customDefinition.getValue());
            definition = targetNode;
        }
        if (typeDetails.isNullable()) {
            this.makeNullable(definition);
        }
        return new AbstractMap.SimpleEntry<>(definition, customDefinition.shouldIncludeAttributes());
    }
Preparation Step: add the given target type. Also catering for forced inline-definitions and ignoring custom definitions.

@param targetNode node in the JSON schema that should represent the targetType
@param typeDetails details of the target type to generate subschema for
jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaGenerationContextImpl.java