Package software.amazon.smithy.docgen
Class DocgenUtils
java.lang.Object
software.amazon.smithy.docgen.DocgenUtils
Provides various utility methods.
-
Method Summary
Modifier and TypeMethodDescriptiongetPrioritizedServiceAuth
(Model model, ToShapeId service) Gets a priority-ordered list of the service's auth types.getSymbolLink
(Symbol symbol, Path relativeTo) Gets a relative link pointing to a given symbol.static String
normalizeNewlines
(String input) Replaces all newline characters in a string with the system line separator.static String
runCommand
(String command, Path directory) Executes a given shell command in a given directory.
-
Method Details
-
runCommand
Executes a given shell command in a given directory.- Parameters:
command
- The string command to execute, e.g. "sphinx-build".directory
- The directory to run the command in.- Returns:
- Returns the console output of the command.
-
normalizeNewlines
Replaces all newline characters in a string with the system line separator.- Parameters:
input
- The string to normalize- Returns:
- A string with system-appropriate newlines.
-
getSymbolLink
Gets a relative link pointing to a given symbol.If the given symbol has no definition file or no
DocSymbolProvider.LINK_ID_PROPERTY
, the response will be empty.- Parameters:
symbol
- The symbol to link to.relativeTo
- A path that the symbol should be relative to. This must be the path to the file containing the link.- Returns:
- Optionally returns a relative link to the given symbol.
-
getPrioritizedServiceAuth
Gets a priority-ordered list of the service's auth types.This includes all the auth types bound to the service, not just those present in the
auth
trait. Auth types not present in the auth trait are at the end of the list, in alphabetical order.- Parameters:
model
- The model being generated from.service
- The service being documented.- Returns:
- returns a priority-ordered list of service auth types.
-