-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bmoric/add fetch source schema in oauth (#19392)
* Update inputs * PR comments and autogen files * Fix oAuth retry * Handle null * Add missing ; * PR comments * use advanced oAuth * PR comments * More PR comments * Format * Avoid conflict in json extract * Format
- Loading branch information
1 parent
324cdce
commit e14b08a
Showing
6 changed files
with
280 additions
and
25 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
40 changes: 40 additions & 0 deletions
40
airbyte-server/src/main/java/io/airbyte/server/handlers/helpers/OAuthPathExtractor.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,40 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.server.handlers.helpers; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class OAuthPathExtractor { | ||
|
||
private static final String PROPERTIES = "properties"; | ||
private static final String PATH_IN_CONNECTOR_CONFIG = "path_in_connector_config"; | ||
|
||
public static Map<String, List<String>> extractOauthConfigurationPaths(final JsonNode configuration) { | ||
|
||
if (configuration.has(PROPERTIES) && configuration.get(PROPERTIES).isObject()) { | ||
final Map<String, List<String>> result = new HashMap<>(); | ||
|
||
configuration.get(PROPERTIES).fields().forEachRemaining(entry -> { | ||
final JsonNode value = entry.getValue(); | ||
if (value.isObject() && value.has(PATH_IN_CONNECTOR_CONFIG) && value.get(PATH_IN_CONNECTOR_CONFIG).isArray()) { | ||
final List<String> path = new ArrayList<>(); | ||
for (final JsonNode pathPart : value.get(PATH_IN_CONNECTOR_CONFIG)) { | ||
path.add(pathPart.textValue()); | ||
} | ||
result.put(entry.getKey(), path); | ||
} | ||
}); | ||
|
||
return result; | ||
} else { | ||
return new HashMap<>(); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.