Skip to content

Commit

Permalink
replace underscores in plugin names with dashes for correct doc link …
Browse files Browse the repository at this point in the history
…generation (#5182)

Signed-off-by: Katherine Shen <[email protected]>
  • Loading branch information
shenkw1 authored Nov 12, 2024
1 parent 85f1718 commit 05aaf65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,14 @@ private Map<String, Class<?>> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void testConvertPluginConfigsIntoJsonSchemasHappyPath() throws JsonProcessingExc
final Map<String, Object> 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));
}
Expand Down

0 comments on commit 05aaf65

Please sign in to comment.