New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve generated documentation #779
Conversation
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt
Outdated
Show resolved
Hide resolved
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/EnumGenerator.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt
Outdated
Show resolved
Hide resolved
...otlin/software/amazon/smithy/rust/codegen/smithy/generators/config/ServiceConfigGenerator.kt
Outdated
Show resolved
Hide resolved
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsFluentClientDecorator.kt
Outdated
Show resolved
Hide resolved
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt
Outdated
Show resolved
Hide resolved
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/ServiceConfigDecorator.kt
Show resolved
Hide resolved
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/RustWriter.kt
Show resolved
Hide resolved
...c/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt
Outdated
Show resolved
Hide resolved
...c/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt
Show resolved
Hide resolved
...c/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt
Outdated
Show resolved
Hide resolved
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsPresigningDecorator.kt
Outdated
Show resolved
Hide resolved
@@ -77,6 +77,7 @@ class CredentialProviderConfig(runtimeConfig: RuntimeConfig) : ConfigCustomizati | |||
self | |||
} | |||
|
|||
/// Set the credentials provider for this service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: on region it's sets
but on this it's set
@@ -73,10 +73,11 @@ class NewFromShared(runtimeConfig: RuntimeConfig) : ConfigCustomization() { | |||
ServiceConfig.ConfigImpl -> writable { | |||
rustTemplate( | |||
""" | |||
/// Creates a new service config from a shared config. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe have this link to the service::Config
here? Could name it ${runtimeConfig.moduleName}::Config
I think
fun default(name: String, public: Boolean): RustModule { | ||
// TODO: figure out how to enable this, but only for real services (protocol tests don't have documentation) | ||
/*val attributes = if (public) { | ||
listOf(Custom("deny(missing_docs)")) | ||
} else { | ||
listOf() | ||
}*/ | ||
return RustModule(name, RustMetadata(public = public)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-) happy to see this gone!
// We need to filter out blank lines—an empty line causes the markdown parser to interpret the subsequent | ||
// docs as a code block because they are indented. | ||
.filter { it.isNotBlank() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you verify this was safe to remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we need to vet the codegen diff for this once that's available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should review the output of cargoDocs, I remember a lot of docs were broken by this
@@ -123,38 +130,46 @@ class CombinedErrorGenerator( | |||
writer.rustBlock("impl ${symbol.name}") { | |||
writer.rustTemplate( | |||
""" | |||
/// Creates a new `${symbol.name}`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is in scope, you can probably just wrap this in [ ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would make this doc link to itself.
@@ -81,10 +81,14 @@ pub fn decode<T: AsRef<str>>(input: T) -> Result<Vec<u8>, DecodeError> { | |||
decode_inner(input.as_ref()) | |||
} | |||
|
|||
/// Failure to decode a base64 value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while we're here
/// Failure to decode a base64 value. | |
/// Failure to decode a base64 value. | |
#[non_exhausive] |
@@ -66,6 +104,7 @@ impl Instant { | |||
} | |||
} | |||
|
|||
/// Parses an `Instant` from a string using the given `format`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Parses an `Instant` from a string using the given `format`. | |
/// Parses an `Instant` from a string using the given [`format`](Format). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is an argument, there will be a link to Format already. I'm following the standard library's lead on this of just naming the arg, but letting the link be in the actual function signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for knocking these out! left some comments on possible doc links.
If possible, it'd be great to use this PR to test out the generated code diff stuff!
4485d80
to
3107434
Compare
fa4ae4d
to
f01b540
Compare
Codegen diff of S3: smithy-rs-779-s3-codegen-diff.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, lets see the output of #791 re: the newlines
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/AwsEndpointDecorator.kt
Show resolved
Hide resolved
) | ||
} | ||
} else { | ||
writable {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is also emptySection
which may be clearer
writable {} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline—is your pre-commit hook enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's enabled, but I wrote some code on another machine that didn't have it enabled. I ran pre-commit on all Kotlin files.
// We need to filter out blank lines—an empty line causes the markdown parser to interpret the subsequent | ||
// docs as a code block because they are indented. | ||
.filter { it.isNotBlank() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should review the output of cargoDocs, I remember a lot of docs were broken by this
Co-authored-by: Russell Cohen <russell.r.cohen@gmail.com>
…/AwsEndpointDecorator.kt Co-authored-by: Russell Cohen <russell.r.cohen@gmail.com>
Description
A lot of generated code was missing documentation. This PR fills in all missing docs for generated SDK crates, and also fills in missing docs on the
smithy-types
crate that is partially re-exported by SDK crates.Testing
Checklist
CHANGELOG.md
aws/SDK_CHANGELOG.md
if applicableBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.