-
Notifications
You must be signed in to change notification settings - Fork 218
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
IDL Model serializer ignores trailing whitespace in documentation #2115
Comments
I agree that the smithy-model serializers should keep the trailing whitespace like you said. However, I would expect the formatter in smithy-syntax to remove it by default though since I think that's what the vast majority of people would expect. |
we're planning to switch to that formatter when it's in the LSP 😅 which is happening in smithy-lang/smithy-language-server#139 |
If you parse this model:
very important: there's a space after foo, before the newline.
then the value of the
documentation
trait is:"foo \nbar"
, which I think is correct.If you serialize that with the
SmithyIdlModelSerializer
, it gets turned into:and the trailing space is gone. As a result, if you parse that again, you no longer have the same documentation trait value (it's
foo\nbar
instead), which causes the following problems for my team:model merging considers these shapes different (because of the trait change), which fails to assemble.
Name uniqueness checks start to consider the shape different from its original counterpart (for a specific reason, we have an identical shape in another namespace, but it's used verbatim instead of being parsed + serialized, so it still has the trailing space).
I think this is an inconsistency in the serializer - as much as I love to remove trailing whitespace, it clearly can cause subtle bugs.
Full example, a scala-cli script:
Edit: this is also inconsistent with the
ModelSerializer
which encodes as aNode
- that one keeps the whitespace.The text was updated successfully, but these errors were encountered: