@Override
        public CustomDefinition provideCustomSchemaDefinition(ResolvedType targetType, SchemaGenerationContext context) {
            ResolvedType keyType = context.getTypeContext().getTypeParameterFor(targetType, Map.class, 0);
            if (keyType == null || !keyType.isInstanceOf(Enum.class)) {
                // only consider Maps with an Enum as key
                return null;
            }
            ResolvedType valueType = Optional.ofNullable(context.getTypeContext().getTypeParameterFor(targetType, Map.class, 1))
                    .orElseGet(()  -> context.getTypeContext().resolve(Object.class));
            ObjectNode customSchema = context.getGeneratorConfig().createObjectNode();
            ObjectNode propertiesNode = context.getGeneratorConfig().createObjectNode();
            customSchema.set(context.getKeyword(SchemaKeyword.TAG_PROPERTIES), propertiesNode);
            Stream.of(((Class<? extends Enum<?>>) keyType.getErasedType()).getEnumConstants())
                    .map(this.propertyNameSupplier)
                    .forEach(propertyName -> propertiesNode.set(propertyName,
                            context.createStandardDefinitionReference(valueType, this)));
            return new CustomDefinition(customSchema);
        }
Example created in response to <a href="https://github.com/victools/jsonschema-generator/discussions/376">#376</a>.
<br/>
Representing a Map containing Enum values as keys.
jsonschema-examples/src/main/java/com/github/victools/jsonschema/examples/EnumMapExample.java