Skip to content

Commit 66582ff

Browse files
committed
Implement HTML rendering for Operation ID change
1 parent 2c54cd9 commit 66582ff

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

core/src/main/java/org/openapitools/openapidiff/core/output/HtmlRender.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import static j2html.TagCreator.meta;
1717
import static j2html.TagCreator.ol;
1818
import static j2html.TagCreator.p;
19+
import static j2html.TagCreator.pre;
1920
import static j2html.TagCreator.span;
2021
import static j2html.TagCreator.title;
2122
import static j2html.TagCreator.ul;
@@ -33,6 +34,7 @@
3334
import j2html.tags.specialized.HtmlTag;
3435
import j2html.tags.specialized.LiTag;
3536
import j2html.tags.specialized.OlTag;
37+
import j2html.tags.specialized.SpanTag;
3638
import j2html.tags.specialized.UlTag;
3739
import java.io.IOException;
3840
import java.io.OutputStreamWriter;
@@ -56,6 +58,7 @@
5658
import org.openapitools.openapidiff.core.model.DiffContext;
5759
import org.openapitools.openapidiff.core.model.DiffResult;
5860
import org.openapitools.openapidiff.core.model.Endpoint;
61+
import org.openapitools.openapidiff.core.model.schema.ChangedOperationId;
5962
import org.openapitools.openapidiff.core.utils.RefPointer;
6063
import org.openapitools.openapidiff.core.utils.RefType;
6164

@@ -202,6 +205,11 @@ private OlTag ol_changed(List<ChangedOperation> changedOperations) {
202205
.orElse("");
203206

204207
UlTag ul_detail = ul().withClass("detail");
208+
if (result(changedOperation.getOperationId()).isDifferent()) {
209+
ul_detail.with(
210+
li().with(h3("Operation ID")).with(ul_operation_id(changedOperation.getOperationId()))
211+
);
212+
}
205213
if (result(changedOperation.getParameters()).isDifferent()) {
206214
ul_detail.with(
207215
li().with(h3("Parameters")).with(ul_param(changedOperation.getParameters())));
@@ -561,4 +569,12 @@ private LiTag li_changedParam(ChangedParameter changeParam) {
561569
}
562570
return li;
563571
}
572+
573+
private UlTag ul_operation_id(ChangedOperationId changedOperationId) {
574+
SpanTag spanTag = span("Changed");
575+
spanTag.with(pre(changedOperationId.getLeft()));
576+
spanTag.withText("to");
577+
spanTag.with(pre(changedOperationId.getRight()));
578+
return ul().withClass("change").with(li().with(spanTag));
579+
}
564580
}

0 commit comments

Comments
 (0)