-
Notifications
You must be signed in to change notification settings - Fork 31
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
fix: Add documentation generation for operations. #578
Conversation
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.
A couple things:
- We should change the format to the following:
/// - Throws: `BucketAlreadyExists`: The requested bucket name is not available.
///
/// `BucketAlreadyOwnedByYou`: The bucket you tried to create already exists, and you own it.
Note the backticks around the exception name and the empty comment line between exceptions. This renders as follows in Xcode inline docs:
- We should add
Parameters
andReturns
to the inline function comment docs as well, for completeness. We can write a separate ticket for that feature though.
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.
Just a few more Kotlin syntax suggestions!
smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ServiceGenerator.kt
Outdated
Show resolved
Hide resolved
smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ServiceGenerator.kt
Outdated
Show resolved
Hide resolved
smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ServiceGenerator.kt
Outdated
Show resolved
Hide resolved
smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ServiceGenerator.kt
Outdated
Show resolved
Hide resolved
smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ServiceGenerator.kt
Outdated
Show resolved
Hide resolved
…ithy-swift into fix/add-error-info-generation
9cacbe3
to
958caf2
Compare
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.
One more change to make use of Kotlin syntax and then I am good to approve!
smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ServiceGenerator.kt
Outdated
Show resolved
Hide resolved
…ithy-swift into fix/add-error-info-generation
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
This PR adds in-line documentation generation for operations.
Issue #
awslabs/aws-sdk-swift#1033
Description of changes
Issue #1033 is resolved by adding documentation generation for errors thrown by operations.
When a service client protocol and service client are generated, for each and every operation, the code generator now generates in-line documentation for parameters, return type, and each and every error thrown by that operation (both errors common to that service, and errors bound to that operation), in the standard Swift in-line documentation format accepted by Swift DocC, like the following :
Error name is extracted from name of the error structs from the corresponding operation shape.
Error cause is extracted from documentation on the error struct from the the corresponding service model file. If no documentation is provided for a given error struct in the original model file, "[no documentation found]" is appended as the error cause.
Below are example code-generated output, as well as what it looks like in Swift DocC:
Generated in-line documentation:
Quick-help view of in-line doc:
Documentation built with generated in-line doc:
This change was tested using tests in the
smithy-swift
project, as well as codegen tests inaws-sdk-swift
project.Scope
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.