-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
airbyte-server/src/main/java/io/airbyte/server/apis/OpenapiApiController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis; | ||
|
||
import io.airbyte.api.generated.OpenapiApi; | ||
import io.airbyte.server.handlers.OpenApiConfigHandler; | ||
import java.io.File; | ||
import javax.ws.rs.Path; | ||
import lombok.AllArgsConstructor; | ||
|
||
@Path("/v1/openapi") | ||
@AllArgsConstructor | ||
public class OpenapiApiController implements OpenapiApi { | ||
|
||
private final OpenApiConfigHandler openApiConfigHandler; | ||
|
||
@Override | ||
public File getOpenApiSpec() { | ||
return ConfigurationApi.execute(openApiConfigHandler::getFile); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
airbyte-server/src/main/java/io/airbyte/server/apis/binders/OpenapiApiBinder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis.binders; | ||
|
||
import io.airbyte.server.apis.OpenapiApiController; | ||
import io.airbyte.server.apis.factories.OpenapiApiFactory; | ||
import org.glassfish.hk2.utilities.binding.AbstractBinder; | ||
import org.glassfish.jersey.process.internal.RequestScoped; | ||
|
||
public class OpenapiApiBinder extends AbstractBinder { | ||
|
||
@Override | ||
protected void configure() { | ||
bindFactory(OpenapiApiFactory.class) | ||
.to(OpenapiApiController.class) | ||
.in(RequestScoped.class); | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
airbyte-server/src/main/java/io/airbyte/server/apis/factories/OpenapiApiFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.apis.factories; | ||
|
||
import io.airbyte.server.apis.OpenapiApiController; | ||
import io.airbyte.server.handlers.OpenApiConfigHandler; | ||
import org.glassfish.hk2.api.Factory; | ||
|
||
public class OpenapiApiFactory implements Factory<OpenapiApiController> { | ||
|
||
private static OpenApiConfigHandler openApiConfigHandler; | ||
|
||
public static void setValues(final OpenApiConfigHandler openApiConfigHandler) { | ||
OpenapiApiFactory.openApiConfigHandler = openApiConfigHandler; | ||
} | ||
|
||
@Override | ||
public OpenapiApiController provide() { | ||
return new OpenapiApiController(openApiConfigHandler); | ||
} | ||
|
||
@Override | ||
public void dispose(final OpenapiApiController instance) { | ||
/* no op */ | ||
} | ||
|
||
} |