All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qdesrame.openapi.diff.model.ChangedPaths Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package com.qdesrame.openapi.diff.model;

import io.swagger.v3.oas.models.PathItem;
import lombok.Getter;
import lombok.Setter;

import java.util.LinkedHashMap;
import java.util.Map;

@Getter
@Setter
public class ChangedPaths implements Changed {
    private Map oldPathMap;
    private Map newPathMap;

    private Map increased;
    private Map missing;
    private Map changed;

    public ChangedPaths(Map oldPathMap, Map newPathMap) {
        this.oldPathMap = oldPathMap;
        this.newPathMap = newPathMap;
        this.increased = new LinkedHashMap<>();
        this.missing = new LinkedHashMap<>();
        this.changed = new LinkedHashMap<>();
    }

    @Override
    public boolean isDiff() {
        return !increased.isEmpty() || !missing.isEmpty() || !changed.isEmpty();
    }

    @Override
    public boolean isDiffBackwardCompatible() {
        return missing.isEmpty() && changed.values().stream().allMatch(ChangedPath::isDiffBackwardCompatible);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy