Skip to content

Commit 81b540d

Browse files
committed
fix(build,openapi): location corrected and build speedup
Put generated OpenAPI specs in MicroProfile OpenAPI 3.1 compliant location at META-INF/openapi.yaml/json. Also enable operationId strategy to generate unique names. In addition, skip scanning of dependencies and focus on our own packages to speed up the build time for the spec.
1 parent 3f3145e commit 81b540d

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

pom.xml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@
3232
<poi.version>5.2.1</poi.version>
3333
<tika.version>2.4.1</tika.version>
3434
<netcdf.version>5.5.3</netcdf.version>
35-
36-
<smallrye.schemaFilename>dataverse_openapi</smallrye.schemaFilename>
37-
<smallrye.infoTitle>Dataverse API</smallrye.infoTitle>
38-
<smallrye.outputDirectory>src/main/resources/edu/harvard/iq/dataverse/openapi</smallrye.outputDirectory>
35+
36+
<openapi.infoTitle>Dataverse API</openapi.infoTitle>
37+
<openapi.infoVersion>${project.version}</openapi.infoVersion>
38+
<openapi.infoDescription>Dataverse is an open source publication repository software with an API first approach.</openapi.infoDescription>
39+
<!-- https://download.eclipse.org/microprofile/microprofile-open-api-3.1.1/microprofile-openapi-spec-3.1.1.html#_location_and_formats -->
40+
<openapi.outputDirectory>${project.build.outputDirectory}/META-INF</openapi.outputDirectory>
3941
</properties>
4042

4143
<!-- Versions of dependencies used both directly and transitive are managed here.
@@ -686,7 +688,6 @@
686688
<include>**/firstNames/*.*</include>
687689
<include>**/*.xsl</include>
688690
<include>**/services/*</include>
689-
<include>**/openapi/*</include>
690691
</includes>
691692
</resource>
692693
<resource>
@@ -699,22 +700,6 @@
699700
</resource>
700701
</resources>
701702
<plugins>
702-
<plugin>
703-
<artifactId>smallrye-open-api-maven-plugin</artifactId>
704-
<groupId>io.smallrye</groupId>
705-
<executions>
706-
<execution>
707-
<goals>
708-
<goal>generate-schema</goal>
709-
</goals>
710-
</execution>
711-
</executions>
712-
<configuration>
713-
<schemaFilename>${smallrye.schemaFilename}</schemaFilename>
714-
<infoTitle>${smallrye.infoTitle}</infoTitle>
715-
<outputDirectory>${smallrye.outputDirectory}</outputDirectory>
716-
</configuration>
717-
</plugin>
718703
<plugin>
719704
<groupId>org.apache.maven.plugins</groupId>
720705
<artifactId>maven-compiler-plugin</artifactId>
@@ -907,6 +892,30 @@
907892
<consoleOutput>true</consoleOutput>
908893
</configuration>
909894
</plugin>
895+
<plugin>
896+
<groupId>io.smallrye</groupId>
897+
<artifactId>smallrye-open-api-maven-plugin</artifactId>
898+
<version>3.10.0</version>
899+
<executions>
900+
<execution>
901+
<goals>
902+
<goal>generate-schema</goal>
903+
</goals>
904+
<!-- Plugin scans class files, not sources. Execute after compile phase but before package -->
905+
<phase>prepare-package</phase>
906+
<configuration>
907+
<outputDirectory>${openapi.outputDirectory}</outputDirectory>
908+
<schemaFilename>openapi</schemaFilename>
909+
<infoTitle>${openapi.infoTitle}</infoTitle>
910+
<infoVersion>${openapi.infoVersion}</infoVersion>
911+
<infoDescription>${openapi.infoDescription}</infoDescription>
912+
<operationIdStrategy>CLASS_METHOD</operationIdStrategy>
913+
<scanPackages>edu.harvard.iq.dataverse</scanPackages>
914+
<scanDependenciesDisable>true</scanDependenciesDisable>
915+
</configuration>
916+
</execution>
917+
</executions>
918+
</plugin>
910919
</plugins>
911920
</build>
912921
<profiles>

0 commit comments

Comments
 (0)