Commit 00cea3e8 authored by Pat Nadolny's avatar Pat Nadolny
Browse files

Revert "Merge branch 'revert-88b71138' into 'main'"

This reverts commit ba5023f5, reversing
changes made to 88b71138.
parent bb96a220
......@@ -23,7 +23,7 @@ variants:
kind: password
- name: recent_workouts_number
label: Number of Workouts to Fetch
default: 5
value: 5
kind: integer
description: The number of workouts to fetch. This is an integer that defaults
to 5.
......
......@@ -43,7 +43,7 @@ variants:
label: Include Anonymous Visitors
description: Defines whether or not to include anonymous visitors in the results.
kind: boolean
default: false
value: false
value_post_processor: stringify
- name: start_date
label: Start Date
......
......@@ -32,7 +32,7 @@ variants:
- name: truncate
label: Truncate
description: Remove file contents after processing (Optional. Default - true)
default: true
value: true
kind: boolean
- name: deviceId
label: Device ID
......
......@@ -12,37 +12,82 @@ class MeltanoJsonGenerator < Jekyll::Generator
'transformers',
'utilities'
]
plugin_index = generate_json_index(site, plugin_types)
plugins_list = _compile_plugins_list(site)
plugin_index = generate_json_index(site, plugin_types, plugins_list)
plugin_types.each do |plugin_type|
generate_json(site, plugin_type)
generate_json(site, plugin_type, plugins_list)
generate_file(site, "/meltano/api/v1/plugins/#{plugin_type}", "index", JSON.generate(plugin_index[plugin_type]))
end
end
def _remove_extras(plugin_variant_def)
plugin_variant_def.delete("variants")
plugin_variant_def.delete("singer_plugin")
plugin_variant_def.delete("url")
def _clean_top(plugin_variant_def)
accepted_list = [
"name",
"pip_url",
"variant",
"namespace",
"label",
"description",
"executable",
"settings",
"docs",
"repo",
"logo_url",
"hidden",
"settings_group_validation",
"commands",
"capabilities",
"metadata",
"schema",
"select",
"update",
"dialect",
"target_schema",
"mappings"
]
plugin_variant_def.each do |key, value|
if !accepted_list.include? key
plugin_variant_def.delete(key)
end
end
return plugin_variant_def
end
def _clean_variant(variant)
remove_list = [
"maintainer",
accepted_list = [
"name",
"pip_url",
"variant",
"namespace",
"label",
"description",
"executable",
"settings",
"docs",
"repo",
"logo_url",
"hidden",
"metrics",
"original",
"url",
"default"
"settings_group_validation",
"commands",
"capabilities",
"metadata",
"schema",
"select",
"update",
"dialect",
"target_schema",
"mappings"
]
remove_list.each do |key|
variant.delete(key)
variant.each do |key, value|
if !accepted_list.include? key
variant.delete(key)
end
end
return variant
end
def _definition_from_multi_variant(plugin, variant)
plugin_variant_def = _remove_extras(plugin.clone)
plugin_variant_def = _clean_top(plugin.clone)
plugin_variant_def["logo_url"] = _get_logo_url(plugin)
variant = _clean_variant(variant)
variant.each_key do |key|
......@@ -56,7 +101,7 @@ class MeltanoJsonGenerator < Jekyll::Generator
end
def _definition_from_single_variant(plugin)
clean_plugin = _remove_extras(plugin.clone)
clean_plugin = _clean_top(plugin.clone)
clean_plugin["logo_url"] = _get_logo_url(plugin)
return clean_plugin
end
......@@ -126,8 +171,32 @@ class MeltanoJsonGenerator < Jekyll::Generator
return index
end
def generate_json(site, collection)
plugins = site.data["meltano"][collection].values
def _add_custom_to_list(plugins_list, plugin_data, plugin_type)
# TODO: when an extractor/loader exists we skip the custom variants
plugin_data.each do |tap_name, definition|
if !plugins_list[plugin_type].key?(tap_name)
singer_name = definition["singer_name"].clone()
singer_name.gsub! '-', '_'
definition["namespace"] = singer_name
definition["name"] = definition["singer_name"]
plugins_list[plugin_type][definition["singer_name"]] = definition
end
end
end
def _compile_plugins_list(site)
plugins_list = site.data["meltano"].clone()
taps = site.data["taps"].clone()
_add_custom_to_list(plugins_list, taps, "extractors")
targets = site.data["targets"].clone()
_add_custom_to_list(plugins_list, targets, "loaders")
return plugins_list
end
def generate_json(site, collection, plugins_list)
plugins = plugins_list[collection].values
plugins.each do |plugin|
if plugin.key?("variants")
......@@ -143,10 +212,8 @@ class MeltanoJsonGenerator < Jekyll::Generator
end
def generate_json_index(site, plugin_types)
plugins = site.data["meltano"]
index = _build_index(plugins, plugin_types)
def generate_json_index(site, plugin_types, plugins_list)
index = _build_index(plugins_list, plugin_types)
generate_file(site, "/meltano/api/v1/plugins", "index", JSON.generate(index))
return index
......
......@@ -37,6 +37,7 @@
"state",
"about",
"stream-maps",
"schema-flattening",
"activate-version",
"batch",
"test",
......
......@@ -45,7 +45,8 @@
},
"target_schema": {
"description": "The name of the database schema the loader has been configured to load data into (assuming the destination supports schemas), so that transformers in the same pipeline can determine the database schema to load data from."
}
},
"hidden": {}
}
}
]
......
......@@ -349,28 +349,6 @@
"title": "The value schema",
"description": "An explanation about the purpose of this instance."
},
"default": {
"id": "#/properties/variants/items/properties/settings/items/properties/default",
"oneOf": [
{
"type": "string"
},
{
"type": "boolean"
},
{
"type": "integer"
},
{
"type": "object"
},
{
"type": "array"
}
],
"title": "The default value schema",
"description": "An explanation about the purpose of this instance."
},
"value_post_processor": {
"id": "#/properties/variants/items/properties/settings/items/properties/value_post_processor",
"type": "string",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment