johnstonskj / rust-atelier

Rust native core model for the AWS Smithy IDL
MIT License
76 stars 10 forks source link

[Feature] cargo-atelier's lint and validate should work on models built from multiple namespace files #27

Closed stevelr closed 3 years ago

stevelr commented 3 years ago

Is your feature request related to a problem? Please describe. Non-trivial smithy models span files and namespaces, but cargo-atelier's lint and validate only work with a single file.

If the smithy model file contains use statements that depend on shapes defined in other model files, cargo-atelier's lint and validate commands generate fatal errors because of undefined shapes. If you concatenate all the model files that together define all the relevant shapes, it also fails, because the parser doesn't accept a file with multiple namespace declarations.

Describe the solution you'd like cargo-atelier should support multiple input files from the command line.

Additional context Submitted a fix in PR #26

johnstonskj commented 3 years ago

Part 2 is correct, the syntax for the Smithy IDL explicitly disallows multiple namespace statements in a single file so the only way to do this is to assemble a semantic model from multiple files.

The model assembler is intended (and somewhat tested) for this case however cargo-atelier was not updated for this case.

johnstonskj commented 3 years ago

Implemented now, it ditches the notion of input file type on the command-line as that's one of the features of the assembler. Note that paths passed to --in-file can actually be directories full of files.

johnstonskj commented 3 years ago

See https://github.com/johnstonskj/rust-atelier/commit/825fd254c4de663aeb4b975a811ca9ca26ebcf3e