Skip to content

Commit

Permalink
Merge branch 'master' into Issue2046
Browse files Browse the repository at this point in the history
  • Loading branch information
gracekarina authored Jan 30, 2024
2 parents 19c65e7 + d057528 commit 6717e8e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public void processSchema(Schema schema) {

public void processSchemaType(Schema schema){

if (schema == null) {
return;
}
if (schema instanceof ArraySchema) {
processArraySchema((ArraySchema) schema);
}
Expand Down Expand Up @@ -215,7 +218,7 @@ private void changeDiscriminatorMapping(ComposedSchema composedSchema, String ol
public void processArraySchema(ArraySchema arraySchema) {

final Schema items = arraySchema.getItems();
if (items.get$ref() != null) {
if (items != null && items.get$ref() != null) {
processReferenceSchema(items);
}else{
processSchemaType(items);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,9 @@ public void copyVendorExtensions(Schema source, Schema target) {
}

private boolean isObjectSchema(Schema schema) {
if (schema == null) {
return false;
}
return schema instanceof ObjectSchema
|| "object".equalsIgnoreCase(schema.getType())
|| (schema.getType() == null && schema.getProperties() != null && !schema.getProperties().isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1464,4 +1464,13 @@ private static int getDynamicPort() {
return new Random().ints(50000, 60000).findFirst().getAsInt();
}

@Test
public void testResolveArraySchemaItemsNullPointerException() {
final ParseOptions options = new ParseOptions();
options.setResolve(true);
final String actualLocation = "C:/Users/ggregory/git/r/api-gateway/ais-swagger-test-fixtures/src/test/resources/APIs-guru/openapi-directory-master/APIs/clearblade.com/3.0/swagger.yaml";
final OpenAPI output = new OpenAPIV3Parser().read(actualLocation, null, options);
new OpenAPIResolver(output, null, actualLocation).resolve();
}

}

0 comments on commit 6717e8e

Please sign in to comment.