private void reduceRedundantAttributesIfPossible(ObjectNode memberSchema, Map<String, JsonNode> referencedDefinition) {
        Set<String> skippedKeywords = new HashSet<>();
        String ifKeyword = this.config.getKeyword(SchemaKeyword.TAG_IF);
        String thenKeyword = this.config.getKeyword(SchemaKeyword.TAG_THEN);
        String elseKeyword = this.config.getKeyword(SchemaKeyword.TAG_ELSE);
        boolean shouldSkipConditionals = !Util.nullSafeEquals(memberSchema.get(ifKeyword), referencedDefinition.get(ifKeyword))
                || !Util.nullSafeEquals(memberSchema.get(thenKeyword), referencedDefinition.get(thenKeyword))
                || !Util.nullSafeEquals(memberSchema.get(elseKeyword), referencedDefinition.get(elseKeyword));
        if (shouldSkipConditionals) {
            skippedKeywords.add(ifKeyword);
            skippedKeywords.add(thenKeyword);
            skippedKeywords.add(elseKeyword);
        }
        for (Iterator<Map.Entry<String, JsonNode>> it = memberSchema.fields(); it.hasNext(); ) {
            Map.Entry<String, JsonNode> memberAttribute = it.next();
            String keyword = memberAttribute.getKey();
            if (!skippedKeywords.contains(keyword) && memberAttribute.getValue().equals(referencedDefinition.get(keyword))) {
                // remove member attribute, that also exists on the referenced definition
                it.remove();
            }
        }
    }
Discard attributes on the given member schema, if those same attributes are already contained in the common definition being referenced.

@param memberSchema single schema to discard redundant attributes from
@param referencedDefinition attribute names and values in the common definition, which don't need to be repeated
jsonschema-generator/src/main/java/com/github/victools/jsonschema/generator/impl/SchemaCleanUpUtils.java