airbytehq/terraform-provider-airbyte

airbyte_source_trustpilot Errors: json schema validation failed when comparing the data to the json schema

DDynamic opened this issue · 1 comments

After upgrading from 0.3.4 to 0.3.6, I receive the following error when applying the Trustpilot source.

I noticed that when comparing the documentation between 0.3.4 and 0.3.6, the auth_type parameter was removed. I am guessing this is needed so that the Airbyte API knows what JSON schema to validate against.

│ Error: unexpected response from API. Got an unexpected response code 422
│ 
│   with airbyte_source_trustpilot.trustpilot,
│   on sources.tf line 11, in resource "airbyte_source_trustpilot" "trustpilot":
│   11: resource "airbyte_source_trustpilot" "trustpilot" {
│ 
│ **Request**:
│ PUT /v1/sources/REDACTED HTTP/1.1
│ Host: localhost:8006
│ Accept: */*
│ Authorization: Basic REDACTED
│ Content-Type: application/json
│ User-Agent: speakeasy-sdk/go 0.3.5 2.206.3 1.0.0 airbyte
│ 
│ {"configuration":{"business_units":["REDACTED"],"credentials":{"access_token":"REDACTED","client_id":"REDACTED","client_secret":"REDACTED","refresh_token":"REDACTED","token_expiry_date":"REDACTED"},"start_date":"REDACTED"},"name":"TrustPilot","workspaceId":"REDACTED"}
│ **Response**:
│ HTTP/1.1 422 Unprocessable Entity
│ Connection: keep-alive
│ Content-Type: application/problem+json
│ Date: Mon, 04 Dec 2023 15:48:44 GMT
│ Server: nginx/1.25.3
│ 
│ {"type":"https://reference.airbyte.com/reference/errors#unprocessable-entity","title":"unprocessable-entity","status":422,"detail":"The provided configuration does not fulfill the
│ specification. Errors: json schema validation failed when comparing the data to the json schema. \nErrors: $.credentials: should be valid to one and only one of schema, but more than one are
│ valid: {\"type\":\"object\",\"title\":\"OAuth
│ 2.0\",\"required\":[\"client_id\",\"client_secret\",\"refresh_token\",\"access_token\",\"token_expiry_date\"],\"properties\":{\"auth_type\":{\"type\":\"string\",\"const\":\"oauth2.0\"},\"client_id\":{\"type\":\"string\",\"title\":\"API
│ key\",\"description\":\"The API key of the Trustpilot API application. (represents the OAuth Client ID)\",\"airbyte_secret\":true},\"access_token\":{\"type\":\"string\",\"title\":\"Access
│ Token\",\"description\":\"Access Token for making authenticated requests.\",\"airbyte_secret\":true},\"client_secret\":{\"type\":\"string\",\"title\":\"Secret\",\"description\":\"The Secret
│ of the Trustpilot API application. (represents the OAuth Client Secret)\",\"airbyte_secret\":true},\"refresh_token\":{\"type\":\"string\",\"title\":\"Refresh token\",\"description\":\"The key
│ to refresh the expired access_token.\",\"airbyte_secret\":true},\"token_expiry_date\":{\"type\":\"string\",\"title\":\"Token expiry date time\",\"format\":\"date-time\",\"description\":\"The
│ date-time when the access token should be refreshed.\"}}}{\"type\":\"object\",\"title\":\"API
│ Key\",\"required\":[\"client_id\"],\"properties\":{\"auth_type\":{\"type\":\"string\",\"const\":\"apikey\"},\"client_id\":{\"type\":\"string\",\"title\":\"API key\",\"description\":\"The API
│ key of the Trustpilot API application.\",\"airbyte_secret\":true}},\"description\":\"The API key authentication method gives you access to only the streams which are part of the Public API.
│ When you want to get streams available via the Consumer API (e.g. the private reviews) you need to use authentication method OAuth 2.0.\"} "}
resource "airbyte_source_trustpilot" "trustpilot" {
  configuration = {
    business_units = [
      "REDACTED",
    ]
    credentials = {
      o_auth20 = {
        access_token      =  "REDACTED"
        client_id         =  "REDACTED"
        client_secret     =  "REDACTED"
        refresh_token     =  "REDACTED"
        token_expiry_date =  "REDACTED"
      }
    }
    source_type = "trustpilot"
    start_date  =  "REDACTED"
  }
  name         =  "REDACTED"
  workspace_id =  "REDACTED"
}

Hey -- I've replicated this and a fix is on it's way (ideally today)