smithy-lang / smithy-dafny

Apache License 2.0
10 stars 8 forks source link

[.NET] Support @documentation trait only for plaintext content #359

Open texastony opened 6 months ago

texastony commented 6 months ago

Issue

Currently, the Java generated code contains documentation from the Smithy Model that is annotated with @javadoc.

.NET generated code does not.

Thus, products that use Smithy-Dafny for .NET do not get API documentation, AND these products are harder to use in .NET.

Fix

Since @javadoc only supports plaintext content, we can decide that smithy-dafny supports the standard @documentation trait but only if it does not contain any markup. We can add a validator that produces WARNING events for any @documentation traits that contain markup. Then we can just replace @javadoc with @documentation in existing models and deprecate the former.

Original proposed fix:

Refactor the .NET generation logic to respect @javadoc.

This is related to https://github.com/smithy-lang/smithy-dafny/issues/247, but does not go as far.

robin-aws commented 6 months ago

While it seems very weird to support a trait named @javadoc on other languages, I understand the motivation here that existing projects have used @javadoc with plaintext content that doesn't use any CommonMark markup, and therefore is fine to use for other languages.

I think instead that smithy-dafny should support @documentation but with a validator that asserts that the content of each instance doesn't have any markup, and replace @javadoc with @documentation in existing models.

texastony commented 6 months ago

I am happy with that proposal!! If #247 is refactored to your proposed scope, this issue can be resolved as a duplicate.

texastony commented 6 months ago

Alternatively, #247 can be left alone and we could revise this issue to be your proposal.

robin-aws commented 6 months ago

Yes let's do that, since it would still be good to fully support @documentation with markup in the future.