Class SnippetConfig
java.lang.Object
software.amazon.smithy.codegen.core.docs.SnippetConfig
- All Implemented Interfaces:
ToNode,ToSmithyBuilder<SnippetConfig>
Represents a file containing generated snippets.
Snippets are generated code based on some trait or other shared definition,
such as the ExamplesTrait. These are
created by code generators and consumed by documentation tools, such as
smithy-docgen.
These are differentiated from typical code gen artifacts in that they are
intended to be shared. These may be distributed and aggregated in any manner,
but they SHOULD be written to the snippets directory of the shared
plugin space by Smithy build plugins. smithy-docgen will discover and include
any snippet files in that directory. Smithy build plugins MUST declare a
runBefore on "docgen" for their generated snippets to be included.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SnippetConfig.Builderbuilder()booleanstatic SnippetConfigGets all the snippets for a particular service.getShapeSnippets(ShapeId serviceId, ShapeId shapeId) Gets the snippets for a particular shape in a service.inthashCode()static SnippetConfigLoads a SnippetConfig from a JSON file.Take this object and create a builder that contains all of the current property values of this object.toNode()Converts a value to aNode.
-
Field Details
-
DEFAULT_VERSION
- See Also:
-
-
Method Details
-
getVersion
- Returns:
- Returns the version of the snippet config.
-
getSnippets
- Returns:
- Returns all the snippets in the config.
-
getServiceSnippets
Gets all the snippets for a particular service.- Parameters:
id- The id of the service to get snippets for.- Returns:
- Returns the snippets for shapes bound to the service.
-
getShapeSnippets
Gets the snippets for a particular shape in a service.- Parameters:
serviceId- The service to search for snippets.shapeId- The shape to get snippets for.- Returns:
- Returns the snippets for a shape from a service.
-
equals
-
hashCode
public int hashCode() -
toBuilder
Description copied from interface:ToSmithyBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilderin interfaceToSmithyBuilder<SnippetConfig>- Returns:
- a builder for type T
-
builder
- Returns:
- Returns a new SnippetConfig builder.
-
toNode
Description copied from interface:ToNodeConverts a value to aNode. -
fromNode
- Parameters:
node- A node representing a SnippetConfig.- Returns:
- Returns a SnippetConfig based on the given node.
-
load
Loads a SnippetConfig from a JSON file.- Parameters:
path- The path to the JSON snippet config.- Returns:
- Returns a SnippetConfig based on the given file.
-