Skip to content

🐛 bug(Source facebook-marketing): remove unused discriminator from spec - #41644

Merged
Aldo Gonzalez (aldogonzalez8) merged 9 commits into
masterfrom
aldogonzalez8/remove_descriminator_from_facebook_marketing_spec
Jul 12, 2024
Merged

Aldo Gonzalez (aldogonzalez8) merged 9 commits into
masterfrom
aldogonzalez8/remove_descriminator_from_facebook_marketing_spec

Conversation

@aldogonzalez8

@aldogonzalez8 Aldo Gonzalez (aldogonzalez8) commented Jul 11, 2024 •

Copy link
Copy Markdown
Contributor

What

It appears that the registry was updated, and Facebook Marketing’s spec now contains a credentials block that references definitions that are not found anywhere.

 "credentials": {
              "title": "Authentication",
              "description": "Credentials for connecting to the Facebook Marketing API",
              "type": "object",
              "discriminator": {
                "propertyName": "auth_type",
                "mapping": {
                  "Client": "#/definitions/OAuthCredentials",
                  "Service": "#/definitions/ServiceAccountCredentials"
                }
              },

That’s causing issues with generating the terraform provider.

Here is the conversation related if you want to make a deep dive.

How

Let's remove unused discriminator

Review guide

  1. integration_tests/spec.json: discrimintor being removed

User Impact

Terraform provider can be generated now

Can this PR be safely reverted and rolled back?

  • YES 💚
  • NO ❌

@vercel

vercel Bot commented Jul 11, 2024 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
airbyte-docs ⬜️ Ignored (Inspect) Visit Preview Jul 11, 2024 11:13pm

@aldogonzalez8

Copy link
Copy Markdown
Contributor Author

Cristina Mariscal (@cmm-airbyte) Baz (@bazarnov)
The live test tool was able to run for this PR, I was trying to do more tests locally, but I'm having some problems with my local internet, is there any special connection id you want to run these changes or do you feel good with this run.

image image

@JonsSpaghetti Jon Tan (JonsSpaghetti) left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'm the right person to review this, but this seems like it would indeed get rid of the thing that's causing my issue.

I think the main thing I want to make sure of as someone who isn't super familiar with which files end up affecting the registry is - is the spec.json file in integration_tests the file that we care about? The fact that it's in integration_tests suggests no, but again I know relatively little about this area.

"title": "Authentication",
"description": "Credentials for connecting to the Facebook Marketing API",
"type": "object",
"discriminator": {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the discriminator used for?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used to distinguish between different schema definitions based on a property value. In this case I think this is a little overloaded as we also are using also OneOf to have one of either schemas

@JonsSpaghetti

Copy link
Copy Markdown
Contributor

Aldo Gonzalez (@aldogonzalez8) looks like there's a version increment check failing FYI

@@ -202,7 +200,6 @@ class Config:
credentials: Optional[Union[OAuthCredentials, ServiceAccountCredentials]] = Field(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without the discriminator field you should remove "Optional" here as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm starting to feel less comfortable with this approach as I'm seeing these objects are gone from required as I remove the discriminator and that feels odd

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually ignore previous comment, let me do more testing on this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this comment was very useful, thanks Cristina Mariscal (@cmm-airbyte)

@aldogonzalez8

Copy link
Copy Markdown
Contributor Author

Baz (@bazarnov) Cristina Mariscal (@cmm-airbyte), with current changes, this is the result diff of the master vs. fix branch (poetry run source-facebook-marketing spec).

Can you confirm that this looks good to you?

1.- Unused discriminator in credentials is gone (unused because the #defined paths won't exist).
2.- Credentials fields was added to required

The spec.json was updated to sync with spec command results.

image image

Comment on lines -202 to -205
credentials: Optional[Union[OAuthCredentials, ServiceAccountCredentials]] = Field(
credentials: Union[OAuthCredentials, ServiceAccountCredentials] = Field(
title="Authentication",
description="Credentials for connecting to the Facebook Marketing API",
discriminator="auth_type",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cristina Mariscal (@cmm-airbyte) I'm just curious about why this used to be optional, it seems credentials are something we always wanted to be required(?). You can look at the spec command results I left in the conversation tab. cc Baz (@bazarnov)

@aldogonzalez8

Aldo Gonzalez (aldogonzalez8) commented Jul 11, 2024 •

Copy link
Copy Markdown
Contributor Author

Service authentication and Oauth worked fine, I set this workspace for my testing if you wish to take a look

image image

image

@aldogonzalez8

Copy link
Copy Markdown
Contributor Author

I re-run live tests after the last change with a couple of streams:

ads_insights_region
image

ads_insights_dma
image

@bazarnov

Baz (bazarnov) commented Jul 12, 2024 •

Copy link
Copy Markdown
Contributor

/approve-regression-tests

Check job output.

✅ Approving regression tests

@aldogonzalez8
Aldo Gonzalez (aldogonzalez8) deleted the aldogonzalez8/remove_descriminator_from_facebook_marketing_spec branch July 12, 2024 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/source/facebook-marketing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants