File tree Expand file tree Collapse file tree
core/src/main/java/org/openapitools/openapidiff/core/model Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ public enum BackwardIncompatibleProp {
1010 EXTENSION_CONTENT_TYPES_DECREASED ("incompatible.extension.content.types.decreased" , false ),
1111 EXTENSION_CONTENT_TYPE_DELETED ("incompatible.extension.content.type.%s.deleted" , false ),
1212 OPENAPI_ENDPOINTS_DECREASED ("incompatible.openapi.endpoints.decreased" , true ),
13+ OPERATION_ID_CHANGED ("incompatible.operation.id.changed" , false ),
1314 REQUEST_BODY_REQUIRED_INCREASED ("incompatible.request.body.increased" , true ),
1415 REQUEST_CONTENT_DECREASED ("incompatible.request.content.decreased" , true ),
1516 REQUEST_ENUM_DECREASED ("incompatible.request.enum.decreased" , true ),
Original file line number Diff line number Diff line change 77import java .util .Arrays ;
88import java .util .List ;
99import java .util .Objects ;
10+ import org .openapitools .openapidiff .core .model .schema .ChangedOperationId ;
1011
1112public class ChangedOperation implements ComposedChanged {
1213 private Operation oldOperation ;
@@ -15,7 +16,7 @@ public class ChangedOperation implements ComposedChanged {
1516 private PathItem .HttpMethod httpMethod ;
1617 private ChangedMetadata summary ;
1718 private ChangedMetadata description ;
18- private ChangedMetadata operationId ;
19+ private ChangedOperationId operationId ;
1920 private boolean deprecated ;
2021 private ChangedParameters parameters ;
2122 private ChangedRequestBody requestBody ;
@@ -92,7 +93,7 @@ public ChangedMetadata getDescription() {
9293 return this .description ;
9394 }
9495
95- public ChangedMetadata getOperationId () {
96+ public ChangedOperationId getOperationId () {
9697 return this .operationId ;
9798 }
9899
@@ -150,7 +151,7 @@ public ChangedOperation setDescription(final ChangedMetadata description) {
150151 return this ;
151152 }
152153
153- public ChangedOperation setOperationId (final ChangedMetadata operationId ) {
154+ public ChangedOperation setOperationId (final ChangedOperationId operationId ) {
154155 this .operationId = operationId ;
155156 return this ;
156157 }
Original file line number Diff line number Diff line change 1+ package org .openapitools .openapidiff .core .model .schema ;
2+
3+ import static org .openapitools .openapidiff .core .model .BackwardIncompatibleProp .OPERATION_ID_CHANGED ;
4+
5+ import java .util .Objects ;
6+ import org .openapitools .openapidiff .core .model .Changed ;
7+ import org .openapitools .openapidiff .core .model .DiffContext ;
8+ import org .openapitools .openapidiff .core .model .DiffResult ;
9+
10+ public class ChangedOperationId implements Changed {
11+
12+ private final String left ;
13+ private final String right ;
14+ private final DiffContext context ;
15+
16+ public ChangedOperationId (String left , String right , DiffContext context ) {
17+ this .left = left ;
18+ this .right = right ;
19+ this .context = context ;
20+ }
21+
22+ @ Override
23+ public DiffResult isChanged () {
24+ if (Objects .equals (left , right )) {
25+ return DiffResult .NO_CHANGES ;
26+ }
27+ if (OPERATION_ID_CHANGED .enabled (context )) {
28+ return DiffResult .INCOMPATIBLE ;
29+ }
30+ return DiffResult .METADATA ;
31+ }
32+
33+ public String getLeft () {
34+ return this .left ;
35+ }
36+
37+ public String getRight () {
38+ return this .right ;
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments