Skip to content
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 @@ -280,7 +280,7 @@ private boolean toYesNo(OpenAPISpec.YesNoOpenAPIOption option) {
}

private File[] getOpenAPIFiles(String directoryName) {
File dir = new File(directoryName);
File dir = new File(pathFromFileURI(resolve(directoryName)));
if (!dir.exists() || !dir.isDirectory()) {
throw new ConfigurationException(format("Cannot open directory %s. Please check the OpenAPI configuration of your API.", dir.getAbsolutePath()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ void referencesDepth() {
assertNotNull(getMail(rec));
}

@Test
void readsDirectoryRelativeToBaseLocation() {
OpenAPISpec spec = new OpenAPISpec();
spec.setDir("paths");

Map<String, OpenAPIRecord> recs = factory.create(singletonList(spec));

assertEquals(3, recs.size());
assertTrue(recs.containsKey("api-b-path-foo-v1-0"));
assertTrue(recs.keySet().stream().anyMatch(id -> id.startsWith("api-a-path-foo-v1-0")));
}

@Test
void getUniqueIdNoCollision() {
assertEquals("customers-api-v1-0", factory.getUniqueId(new HashMap<>(), new OpenAPIRecord(getApi(this, "/openapi/specs/customers.yml"), null)));
Expand All @@ -134,4 +146,4 @@ void getUniqueIdCollision() {
recs.put("customers-api-v1-0", new OpenAPIRecord());
assertEquals("customers-api-v1-0-0", factory.getUniqueId(recs, new OpenAPIRecord(getApi(this, "/openapi/specs/customers.yml"), null)));
}
}
}
Loading