smithy-lang / smithy-dafny

Apache License 2.0
9 stars 8 forks source link

Explicitly reject unsupported shapes/traits #185

Open robin-aws opened 1 year ago

robin-aws commented 1 year ago

E.g. @streaming is currently silently ignored, leading to type errors (e.g. System.IO.Stream vs System.IO.MemoryStream).

~Part of a more general class of "silently does the wrong thing on unrecognized shapes/traits" bugs - is there a more generic way code generation could fail closed on unsupported things?~

I suspect we can write a selector expression for all shapes and traits this generator supports, and just do an initial application of this selector to every model and fail if anything is not covered. This would be similar to the selector the codegen README suggests using to filter out such unsupported features.

robin-aws commented 1 year ago

Note the set of supported features can be different between the Smithy plugin and the CLI: the former should reject resources as per #223, but the latter can allow them.

robin-aws commented 1 year ago

We should also have different selector values per target language.

robin-aws commented 7 months ago

Applied the soundness bug since there are lots of cases where silently ignoring shapes and traits we don't understand means we emit the wrong code, which easily becomes a soundness issue when targeting a language without enough static checking to save us.

texastony commented 7 months ago

@lucasmcdonald3 work currently uses the Java Docs trait to add documentation to generated Python.

It works pretty well.

As such, @robin-aws , what do you think about refactoring the JavaDoc trait to just be a poor man's documentation trait, ideally with a warning that it only works in certain scenarios?

I'd rather not invent a PyDocs trait... but it would also to be weird to see the JavaDoc trait gain support in Python, and then Go... etc.