Skip to content

Commit

Permalink
Merge pull request #1352 from DalgoT4D/1350-bigquery-destination-form…
Browse files Browse the repository at this point in the history
…-showing-undefined

Bigquery form bug (HMAC_key field title showing undefined.)
  • Loading branch information
fatchat authored Dec 18, 2024
2 parents 4d4f078 + 2a50a41 commit c49c073
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/helpers/ConnectorConfigInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ConnectorConfigInput {

prepareSpecsToRender() {
this.specsToRender = ConnectorConfigInput.traverseSpecs([], this.specsData, 'config', [], []);
console.log(this.specsToRender, 'specs to render');
return this.specsToRender;
}

Expand Down Expand Up @@ -164,8 +165,11 @@ class ConnectorConfigInput {
let commonField: string[] = [];

// Find common property among all array elements of 'oneOf' array

if (value['oneOf'] && value['oneOf'].length > 1) {
// Works for more than one element, because for 1 element we cannot find one commonField. The array would be filled with all the properties.
value['oneOf']?.forEach((ele: any) => {
//Fills the common array with all fields in 1st iteration and filters the uncommon fields with subsequent iterations.
if (commonField.length > 0) {
commonField = Object.keys(ele?.properties)
.filter((key: any) => 'const' in ele?.properties[key]) // mongodb connector case. Only cluster type had const property and was not at the top level but with the other properties that were to be rendered if a cluster type is selected.
Expand All @@ -174,6 +178,12 @@ class ConnectorConfigInput {
commonField = Object.keys(ele?.properties);
}
});
} else if (value['oneOf'] && value['oneOf'].length == 1) {
value['oneOf']?.forEach((ele: any) => {
commonField = Object.keys(ele?.properties).filter(
(key: any) => 'const' in ele.properties[key]
);
});
}

// an object type can either have oneOf or properties
Expand Down

0 comments on commit c49c073

Please sign in to comment.