Skip to content

Fix: Address Sonar Blocker issues #775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
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
Expand Up @@ -9,6 +9,6 @@ public class AllOfOneOfDiffTest {
@Test
void allOfReferringToOneOfSchemasAreSupported() {
ChangedOpenApi diff = OpenApiCompare.fromLocations("issue-317_1.json", "issue-317_2.json");
assertThat(diff.isCoreChanged().isUnchanged());
assertThat(diff.isCoreChanged().isUnchanged()).isTrue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ public void schemaPropertyDefaultChanged() {
public void schemaPropertyTypeChanged() {
ChangedOpenApi changedOpenApi =
OpenApiCompare.fromLocations(
"schemaDiff/schema-props-defaults-handling-1.yaml",
"schemaDiff/schema-props-defaults-handling-2.yaml");
"schemaDiff/schema-props-type-handling-1.yaml",
"schemaDiff/schema-props-type-handling-2.yaml");

assertEquals(1, changedOpenApi.getChangedOperations().size());
assertEquals(1, changedOpenApi.getChangedSchemas().size());
ChangedSchema changedSchema = changedOpenApi.getChangedSchemas().get(0);
assertEquals(1, changedSchema.getChangedProperties().size());
assertTrue(changedSchema.getChangedProperties().containsKey("field1"));
assertTrue(changedSchema.getChangedProperties().get("field1").isChangedType());
}

@Test // issue #485
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
openapi: 3.0.0
info:
title: Schema Type Handling Test - Before
version: 1.0.0
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TestSchema'
responses:
'200':
description: OK
components:
schemas:
TestSchema:
type: object
properties:
field1:
type: string
description: A field that will change type
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
openapi: 3.0.0
info:
title: Schema Type Handling Test - After
version: 1.0.0
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TestSchema'
responses:
'200':
description: OK
components:
schemas:
TestSchema:
type: object
properties:
field1:
type: integer # Changed from string to integer
description: A field that has changed type