diff --git a/airbyte_cdk/sources/declarative/declarative_component_schema.yaml b/airbyte_cdk/sources/declarative/declarative_component_schema.yaml index b4dfbb679..f98bf3bee 100644 --- a/airbyte_cdk/sources/declarative/declarative_component_schema.yaml +++ b/airbyte_cdk/sources/declarative/declarative_component_schema.yaml @@ -2043,9 +2043,15 @@ definitions: - "$ref": "#/definitions/NoAuth" - "$ref": "#/definitions/LegacySessionTokenAuthenticator" fetch_properties_from_endpoint: + deprecated: true + deprecation_message: "Use `query_properties` field instead." title: Fetch Properties from Endpoint description: Allows for retrieving a dynamic set of properties from an API endpoint which can be injected into outbound request using the stream_partition.extra_fields. "$ref": "#/definitions/PropertiesFromEndpoint" + query_properties: + title: Query Properties + description: For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields. + "$ref": "#/definitions/QueryProperties" request_parameters: title: Query Parameters description: Specifies the query parameters that should be set on an outgoing HTTP request given the inputs. diff --git a/airbyte_cdk/sources/declarative/models/declarative_component_schema.py b/airbyte_cdk/sources/declarative/models/declarative_component_schema.py index e82c61ccc..0e89ab355 100644 --- a/airbyte_cdk/sources/declarative/models/declarative_component_schema.py +++ b/airbyte_cdk/sources/declarative/models/declarative_component_schema.py @@ -2543,9 +2543,16 @@ class HttpRequester(BaseModelWithDeprecations): ) fetch_properties_from_endpoint: Optional[PropertiesFromEndpoint] = Field( None, + deprecated=True, + deprecation_message="Use `query_properties` field instead.", description="Allows for retrieving a dynamic set of properties from an API endpoint which can be injected into outbound request using the stream_partition.extra_fields.", title="Fetch Properties from Endpoint", ) + query_properties: Optional[QueryProperties] = Field( + None, + description="For APIs that require explicit specification of the properties to query for, this component will take a static or dynamic set of properties (which can be optionally split into chunks) and allow them to be injected into an outbound request by accessing stream_partition.extra_fields.", + title="Query Properties", + ) request_parameters: Optional[Union[Dict[str, Union[str, QueryProperties]], str]] = Field( None, description="Specifies the query parameters that should be set on an outgoing HTTP request given the inputs.", diff --git a/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py b/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py index 2f7619ba5..8301522d5 100644 --- a/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +++ b/airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py @@ -3220,6 +3220,7 @@ def _get_url() -> str: hasattr(model.requester, "fetch_properties_from_endpoint") and model.requester.fetch_properties_from_endpoint ): + # todo: Deprecate this condition once dependent connectors migrate to query_properties query_properties_definition = QueryPropertiesModel( type="QueryProperties", property_list=model.requester.fetch_properties_from_endpoint, @@ -3231,6 +3232,11 @@ def _get_url() -> str: model=query_properties_definition, config=config, ) + elif hasattr(model.requester, "query_properties") and model.requester.query_properties: + query_properties = self.create_query_properties( + model=model.requester.query_properties, + config=config, + ) requester = self._create_component_from_model( model=model.requester, diff --git a/unit_tests/sources/declarative/parsers/test_model_to_component_factory.py b/unit_tests/sources/declarative/parsers/test_model_to_component_factory.py index 216f502a8..4ac0b11e7 100644 --- a/unit_tests/sources/declarative/parsers/test_model_to_component_factory.py +++ b/unit_tests/sources/declarative/parsers/test_model_to_component_factory.py @@ -4404,21 +4404,23 @@ def test_simple_retriever_with_requester_properties_from_endpoint(): url_base: "https://api.hubapi.com" http_method: "GET" path: "adAnalytics" - fetch_properties_from_endpoint: - type: PropertiesFromEndpoint - property_field_path: [ "name" ] - retriever: - type: SimpleRetriever - requester: - type: HttpRequester - url_base: https://api.hubapi.com - path: "/properties/v2/dynamics/properties" - http_method: GET - record_selector: - type: RecordSelector - extractor: - type: DpathExtractor - field_path: [] + query_properties: + type: QueryProperties + property_list: + type: PropertiesFromEndpoint + property_field_path: [ "name" ] + retriever: + type: SimpleRetriever + requester: + type: HttpRequester + url_base: https://api.hubapi.com + path: "/properties/v2/dynamics/properties" + http_method: GET + record_selector: + type: RecordSelector + extractor: + type: DpathExtractor + field_path: [] dynamic_properties_stream: type: DeclarativeStream incremental_sync: