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

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

The newest version!
package com.qdesrame.openapi.diff.model;

import io.swagger.v3.oas.models.parameters.Parameter;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class ChangedParameters implements Changed {
    private List oldParameterList;
    private List newParameterList;

    private List increased;
    private List missing;
    private List changed;

    public ChangedParameters(List oldParameterList, List newParameterList) {
        this.oldParameterList = oldParameterList;
        this.newParameterList = newParameterList;
        this.increased = new ArrayList<>();
        this.missing = new ArrayList<>();
        this.changed = new ArrayList<>();
    }

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

    @Override
    public boolean isDiffBackwardCompatible() {
        return increased.stream().noneMatch(Parameter::getRequired) && missing.isEmpty()
                && changed.stream().allMatch(ChangedParameter::isDiffBackwardCompatible);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy