Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.openapitools.openapidiff.core;

import static org.assertj.core.api.Assertions.assertThat;
import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiChangedEndpoints;

import org.junit.jupiter.api.Test;
import org.openapitools.openapidiff.core.model.ChangedOpenApi;

public class RequestDiffTest {
private final String OPENAPI_DOC1 = "request_diff_1.yaml";
Expand All @@ -12,4 +14,13 @@ public class RequestDiffTest {
public void testDiffDifferent() {
assertOpenApiChangedEndpoints(OPENAPI_DOC1, OPENAPI_DOC2);
}

@Test
public void testSameTypeResponseSchemaDIff() {
ChangedOpenApi changedOpenApi =
OpenApiCompare.fromLocations(
"response_schema_simple_object_type.yaml",
"response_schema_simple_object_type_with_alloff.yaml");
assertThat(changedOpenApi.isCompatible()).isTrue();
}
}
27 changes: 27 additions & 0 deletions core/src/test/resources/response_schema_simple_object_type.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
openapi: "3.0.0"
info:
title: Sample API
description: API description in Markdown.
version: 1.0.0
servers: []
paths:
/test:
get:
summary: Your GET endpoint
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/working'
components:
schemas:
working:
type: object
properties:
foo:
type: string
bar:
type: integer
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
openapi: 3.0.0
info:
title: Sample API
description: API description in Markdown.
version: 1.1.0
servers: []
paths:
/test:
get:
summary: Your GET endpoint
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/working'
operationId: get-test
components:
schemas:
working:
allOf:
- type: object
properties:
foo:
type: string
- $ref: '#/components/schemas/bar'
bar:
type: object
properties:
bar:
type: integer