From 05aaf6572220bb717b9ae6845997df071061ecce Mon Sep 17 00:00:00 2001 From: Katherine Shen <40495707+shenkw1@users.noreply.github.com> Date: Mon, 11 Nov 2024 22:34:37 -0600 Subject: [PATCH] replace underscores in plugin names with dashes for correct doc link generation (#5182) Signed-off-by: Katherine Shen --- .../dataprepper/schemas/PluginConfigsJsonSchemaConverter.java | 3 ++- .../schemas/PluginConfigsJsonSchemaConverterTest.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java b/data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java index eb9c29dd63..4c63731b4f 100644 --- a/data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java +++ b/data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java @@ -118,13 +118,14 @@ private Map> scanForPluginConfigs(final Class pluginType) { private void addDocumentationLink(final ObjectNode jsonSchemaNode, final String pluginName, final Class pluginType) { + String formattedPluginName = pluginName.replace("_", "-"); jsonSchemaNode.put(DOCUMENTATION_LINK_KEY, String.format( PLUGIN_DOCUMENTATION_URL_FORMAT, siteUrl, siteBaseUrl, PLUGIN_TYPE_TO_URI_PARAMETER_MAP.get(pluginType), - pluginName)); + formattedPluginName)); } private void addPluginName(final ObjectNode jsonSchemaNode, diff --git a/data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java b/data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java index 39c5629e0c..3781885afd 100644 --- a/data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java +++ b/data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java @@ -77,7 +77,7 @@ void testConvertPluginConfigsIntoJsonSchemasHappyPath() throws JsonProcessingExc final Map schemaMap = OBJECT_MAPPER.readValue(result.get("test_plugin"), MAP_TYPE_REFERENCE); assertThat(schemaMap, notNullValue()); assertThat(schemaMap.get(DOCUMENTATION_LINK_KEY), equalTo( - "{{site.url}}{{site.baseurl}}/data-prepper/pipelines/configuration/null/test_plugin/" + "{{site.url}}{{site.baseurl}}/data-prepper/pipelines/configuration/null/test-plugin/" )); assertThat(schemaMap.containsKey(PLUGIN_NAME_KEY), is(true)); }