File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed
Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,16 @@ plugins:
1818 - structured-logging
1919
2020 select :
21- - countries.cca3
21+ - countries.*
22+
23+ config :
24+ fields :
25+ - name
26+ - cca2
27+ - cca3
28+ - capital
29+ - region
30+
2231 loaders :
2332 - name : target-jsonl
2433 variant : andyh1203
Original file line number Diff line number Diff line change @@ -52,9 +52,6 @@ def get_url_params(
5252 Returns:
5353 A dictionary of URL query parameters.
5454 """
55- selected_fields = [k [1 ] for k ,v in self .metadata .items () if v .selected and len (k ) == 2 ]
56- if len (selected_fields ) > 10 :
55+ if len (self .config ["fields" ]) > 10 :
5756 raise ValueError ("The API has a maximum of 10 fields per request." )
58- elif len (selected_fields ) == 0 :
59- selected_fields = ["cca3" ]
60- return {"fields" : "," .join (selected_fields )}
57+ return {"fields" : "," .join (self .config ["fields" ])}
Original file line number Diff line number Diff line change @@ -21,7 +21,14 @@ class TapRestCountries(Tap):
2121
2222 name = "tap-restcountries"
2323
24- config_jsonschema = {}
24+ config_jsonschema = th .PropertiesList (
25+ th .Property (
26+ "fields" ,
27+ th .ArrayType (th .StringType ),
28+ required = True ,
29+ description = "List of fields to include in the API response (max 10)." ,
30+ ),
31+ ).to_dict ()
2532
2633 @override
2734 def discover_streams (self ) -> list [streams .RestCountriesStream ]:
You can’t perform that action at this time.
0 commit comments