Skip to content

Commit

Permalink
feat: improve open api generator
Browse files Browse the repository at this point in the history
- support java dsl
- streamline implementation with standard citrus builder pattern
- support open api parameter serialization
  • Loading branch information
Thorsten Schlathoelter authored and bbortt committed Oct 21, 2024
1 parent f9c6ac7 commit 4888f6c
Show file tree
Hide file tree
Showing 255 changed files with 21,708 additions and 13,221 deletions.
15 changes: 15 additions & 0 deletions catalog/citrus-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,21 @@
<artifactId>citrus-openapi</artifactId>
<version>4.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-test-api-core</artifactId>
<version>4.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-test-api-generator-core</artifactId>
<version>4.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-test-api-spring</artifactId>
<version>4.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.citrusframework</groupId>
<artifactId>citrus-jms</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions connectors/citrus-openapi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// TODO
OpenApiServerRequest
- SchemaValidation is active by default (also in other scenarios)

Oas Validation now by ValidationFramework
- no control response message is created any more

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import io.apicurio.datamodels.Library;
import io.apicurio.datamodels.openapi.models.OasDocument;
import java.io.InputStream;
import java.net.URLConnection;
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
import org.apache.hc.client5.http.ssl.TrustAllStrategy;
import org.apache.hc.core5.http.HttpHeaders;
Expand Down Expand Up @@ -109,24 +111,31 @@ public static String rawFromWebResource(URL url) {
}

private static <T> T fromWebResource(URL url, Resolver<T> resolver) {
HttpURLConnection con = null;
URLConnection con = null;
try {
con = (HttpURLConnection) url.openConnection();
con.setRequestMethod(HttpMethod.GET.name());
con.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
con = url.openConnection();

if (con instanceof HttpURLConnection httpURLConnection) {
httpURLConnection.setRequestMethod(HttpMethod.GET.name());
con.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);

int status = httpURLConnection.getResponseCode();
if (status > 299) {
throw new IllegalStateException(
"Failed to retrieve Open API specification: " + url,
new IOException(FileUtils.readToString(httpURLConnection.getErrorStream())));
}
}

int status = con.getResponseCode();
if (status > 299) {
throw new IllegalStateException("Failed to retrieve Open API specification: " + url,
new IOException(FileUtils.readToString(con.getErrorStream())));
} else {
return resolve(FileUtils.readToString(con.getInputStream()), resolver);
try (InputStream inputStream = con.getInputStream()) {
return resolve(FileUtils.readToString(inputStream), resolver);
}

} catch (IOException e) {
throw new IllegalStateException("Failed to retrieve Open API specification: " + url, e);
} finally {
if (con != null) {
con.disconnect();
if (con instanceof HttpURLConnection httpURLConnection) {
httpURLConnection.disconnect();
}
}
}
Expand Down
Loading

0 comments on commit 4888f6c

Please sign in to comment.