-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes for generated doc - Avoid generating `#Examples` when no examples exist - Fix typo * Split out client customizations * Update changelogs * Fix generated READMEs
- Loading branch information
Showing
10 changed files
with
99 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
.../kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/ClientCustomizations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.smithy.customizations | ||
|
||
import software.amazon.smithy.rust.codegen.smithy.CodegenContext | ||
import software.amazon.smithy.rust.codegen.smithy.customize.RustCodegenDecorator | ||
import software.amazon.smithy.rust.codegen.smithy.generators.LibRsCustomization | ||
|
||
/** | ||
* Customizations that apply only to generated clients | ||
*/ | ||
class ClientCustomizations : RustCodegenDecorator { | ||
override val name: String = "ClientCustomizations" | ||
override val order: Byte = 0 | ||
|
||
override fun libRsCustomizations( | ||
codegenContext: CodegenContext, | ||
baseCustomizations: List<LibRsCustomization> | ||
): List<LibRsCustomization> { | ||
return baseCustomizations + ClientDocsGenerator() | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...n/kotlin/software/amazon/smithy/rust/codegen/smithy/customizations/ClientDocsGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.smithy.customizations | ||
|
||
import software.amazon.smithy.rust.codegen.rustlang.Writable | ||
import software.amazon.smithy.rust.codegen.rustlang.containerDocs | ||
import software.amazon.smithy.rust.codegen.rustlang.writable | ||
import software.amazon.smithy.rust.codegen.smithy.generators.LibRsCustomization | ||
import software.amazon.smithy.rust.codegen.smithy.generators.LibRsSection | ||
|
||
class ClientDocsGenerator : LibRsCustomization() { | ||
override fun section(section: LibRsSection): Writable { | ||
return when (section) { | ||
is LibRsSection.ModuleDocumentation -> if (section.subsection == LibRsSection.CrateOrganization) { | ||
crateLayout() | ||
} else emptySection | ||
else -> emptySection | ||
} | ||
} | ||
} | ||
|
||
private fun crateLayout(): Writable = writable { | ||
containerDocs( | ||
""" | ||
The entry point for most customers will be [`Client`]. [`Client`] exposes one method for each API offered | ||
by the service. | ||
Some APIs require complex or nested arguments. These exist in [`model`]. | ||
Lastly, errors that can be returned by the service are contained within [`error`]. [`Error`] defines a meta | ||
error encompassing all possible errors that can be returned by the service. | ||
The other modules within this crate are not required for normal usage. | ||
""".trimEnd() | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters