Hi Apigee Community,
I’ve built and published an open source Java library that converts Apigee API proxy
bundles into OpenAPI 3.0 specifications something I couldn’t find anywhere else in
the Java ecosystem.
Why I built this
Apigee doesn’t natively expose OpenAPI specs through its APIs, and there was no
Java-native solution available to embed directly into applications. I needed a way
to programmatically generate OpenAPI specs from existing proxy bundles without any
manual effort.
What it does
- Converts a proxy bundle ZIP or directory into an OpenAPI 3.0 spec (JSON or YAML)
- Works fully offline from a local bundle file
- Can also fetch bundles directly from Apigee using a service account
- Infers query parameters, headers, and path parameters from policy XMLs
- Automatically detects API Key, OAuth2, and Basic Auth security schemes
Getting Started
Step 1 — Add the dependency to your pom.xml:
io.github.dinithedirisinghe apigee-bundle-to-openapi 1.0.0For Gradle:
implementation ‘io.github.dinithedirisinghe:apigee-bundle-to-openapi:1.0.0’
Step 2 — Convert a local proxy bundle:
ApigeeToOpenApiConverter converter = new ApigeeToOpenApiConverter();
// Convert from a ZIP file or extracted directory
ConversionResult result = converter.convert(Path.of(“./my-proxy.zip”));
// Get as YAML string
String yaml = converter.writeToString(result.getOpenAPI(), OutputFormat.YAML);
// Or save directly to a file
converter.convertAndSave(Path.of(“./my-proxy.zip”), Path.of(“./openapi.yaml”));
Step 3 — Or fetch directly from Apigee without downloading the bundle manually.
Option A: Using a service account key file:
ApigeeApiConfig config = ApigeeApiConfig.builder()
.organization(“my-gcp-project”)
.serviceAccountKeyPath(“/path/to/service-account.json”)
.build();
String yaml = converter.convertFromApigeeToYaml(config, “my-proxy-name”);
Option B: Using a service account JSON string directly in code:
String serviceAccountJson = “{ "type": "service_account", "project_id": "my-project", … }”;
ApigeeApiConfig config = ApigeeApiConfig.builder()
.organization(“my-gcp-project”)
.serviceAccountKeyJson(serviceAccountJson)
.build();
String yaml = converter.convertFromApigeeToYaml(config, “my-proxy-name”);
Option C: Using Application Default Credentials:
ApigeeApiConfig config = ApigeeApiConfig.builder()
.organization(“my-gcp-project”)
.useApplicationDefaultCredentials()
.build();
String yaml = converter.convertFromApigeeToYaml(config, “my-proxy-name”);
Links
- GitHub: GitHub - DinithEdirisinghe/apigee-bundle-to-openapi: Java library to convert Apigee proxy bundles to OpenAPI 3.0 specifications · GitHub
- Maven Central: Maven Central: io.github.dinithedirisinghe:apigee-bundle-to-openapi
Feedback, suggestions, and contributions are very welcome!