use of org.openapitools.openapidiff.core.model.ChangedParameter in project openapi-diff by OpenAPITools.
the class HtmlRender method li_changedParam.
private LiTag li_changedParam(ChangedParameter changeParam) {
if (changeParam.isDeprecated()) {
return li_deprecatedParam(changeParam);
}
boolean changeRequired = changeParam.isChangeRequired();
boolean changeDescription = Optional.ofNullable(changeParam.getDescription()).map(ChangedMetadata::isDifferent).orElse(false);
Parameter rightParam = changeParam.getNewParameter();
Parameter leftParam = changeParam.getNewParameter();
LiTag li = li().withText(changeParam.getName() + " in " + changeParam.getIn());
if (changeRequired) {
li.withText(" change into " + (rightParam.getRequired() ? "required" : "not required"));
}
if (changeDescription) {
li.withText(" Notes ").with(del(leftParam.getDescription()).withClass(COMMENT)).withText(" change into ").with(span(rightParam.getDescription()).withClass(COMMENT));
}
return li;
}
use of org.openapitools.openapidiff.core.model.ChangedParameter in project openapi-diff by OpenAPITools.
the class HtmlRender method ul_param.
private UlTag ul_param(ChangedParameters changedParameters) {
List<Parameter> addParameters = changedParameters.getIncreased();
List<Parameter> delParameters = changedParameters.getMissing();
List<ChangedParameter> changed = changedParameters.getChanged();
UlTag ul = ul().withClass("change param");
for (Parameter param : addParameters) {
ul.with(li_addParam(param));
}
for (ChangedParameter param : changed) {
ul.with(li_changedParam(param));
}
for (Parameter param : delParameters) {
ul.with(li_missingParam(param));
}
return ul;
}
use of org.openapitools.openapidiff.core.model.ChangedParameter in project openapi-diff by OpenAPITools.
the class ParameterDiff method computeDiff.
@Override
protected DeferredChanged<ChangedParameter> computeDiff(HashSet<String> refSet, Parameter left, Parameter right, DiffContext context) {
left = refPointer.resolveRef(this.leftComponents, left, left.get$ref());
right = refPointer.resolveRef(this.rightComponents, right, right.get$ref());
DeferredBuilder<Changed> builder = new DeferredBuilder<>();
ChangedParameter changedParameter = new ChangedParameter(right.getName(), right.getIn(), context).setOldParameter(left).setNewParameter(right).setChangeRequired(getBooleanDiff(left.getRequired(), right.getRequired())).setDeprecated(!Boolean.TRUE.equals(left.getDeprecated()) && Boolean.TRUE.equals(right.getDeprecated())).setChangeAllowEmptyValue(getBooleanDiff(left.getAllowEmptyValue(), right.getAllowEmptyValue())).setChangeStyle(!Objects.equals(left.getStyle(), right.getStyle())).setChangeExplode(getBooleanDiff(left.getExplode(), right.getExplode()));
builder.with(openApiDiff.getSchemaDiff().diff(left.getSchema(), right.getSchema(), context.copyWithRequired(true))).ifPresent(changedParameter::setSchema);
builder.with(openApiDiff.getMetadataDiff().diff(left.getDescription(), right.getDescription(), context)).ifPresent(changedParameter::setDescription);
builder.with(openApiDiff.getContentDiff().diff(left.getContent(), right.getContent(), context)).ifPresent(changedParameter::setContent);
builder.with(openApiDiff.getExtensionsDiff().diff(left.getExtensions(), right.getExtensions(), context)).ifPresent(changedParameter::setExtensions);
return builder.buildIsChanged(changedParameter);
}
Aggregations