Skip to content

Commit 489643c

Browse files
committed
Improve Moqu config documentation
1 parent bab9bbe commit 489643c

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

docs/modules/ROOT/pages/moqu.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,7 @@ The Wiremock definition using the OpenAPI specification above, looks something l
204204
]
205205
}
206206
----
207+
208+
== Configuration Properties
209+
210+
include::./includes/quarkus-openapi-generator-moqu-wiremock.adoc[opts=optional, leveloffset=+1]

moqu/deployment/src/main/java/io/quarkiverse/openapi/generator/MoquProjectProcessor.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.Objects;
99
import java.util.Optional;
1010
import java.util.Set;
11+
import java.nio.file.Paths;
1112
import java.util.stream.Stream;
1213

1314
import org.jboss.logging.Logger;
@@ -88,6 +89,23 @@ void consume(Optional<MoquProjectBuildItem> moquProject,
8889
});
8990
}
9091

92+
private static Path findProjectRoot(Path outputDirectory) {
93+
Path currentPath = outputDirectory;
94+
do {
95+
if (Files.exists(currentPath.resolve(Paths.get("src", "main")))
96+
|| Files.exists(currentPath.resolve(Paths.get("config", "application.properties")))
97+
|| Files.exists(currentPath.resolve(Paths.get("config", "application.yaml")))
98+
|| Files.exists(currentPath.resolve(Paths.get("config", "application.yml")))) {
99+
return currentPath.normalize();
100+
}
101+
if (currentPath.getParent() != null && Files.exists(currentPath.getParent())) {
102+
currentPath = currentPath.getParent();
103+
} else {
104+
return null;
105+
}
106+
} while (true);
107+
}
108+
91109
public static String getExtension(String path) {
92110
Objects.requireNonNull(path, "path is required");
93111
final int i = path.lastIndexOf(".");

moqu/runtime/src/main/java/io/quarkiverse/openapi/generator/moqu/MoquConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public interface MoquConfig {
1212
String DEFAULT_RESOURCE_DIR = "openapi";
1313

1414
/**
15-
* Path to the Moqu (relative to the project).
15+
* Path to the Moqu OpenAPI files, relative to the <code>src/main/resources</code> directory.
1616
*/
1717
@WithDefault(DEFAULT_RESOURCE_DIR)
1818
String resourceDir();

0 commit comments

Comments
 (0)