Atelier: crate cargo_atelier
A cargo command for using Smithy models as a part of a build process.
Usage
> cargo
;
)
Both the lint and validate commands use a common mechanism for printing results and will by default print using a colorized output. As different linter and validation rules can be used the reported by row informs you which rule-set has determined the error.
The document command creates documentation from the model, relying on specific traits for text and the prelude traits for some semantic properties. It used the somedoc crate to do the formatting and so the output format specified in this tool can select any of the formats supported by somedoc.
Example Lint
For the following badly formatted Smithy file, in test-models/lint-test.smithy
.
namespace org.example.smithy
@ThisIsNotAGoodName
structure thisIsMyStructure {
lower: String,
Upper: String,
someJSONThing: someUnknownShape,
OK: Boolean
}
string someUnknownShape
@trait
structure ThisIsNotAGoodName {}
The following issues will be output when the linter runs.
> cargo
Example Validate
For the following erroneous Smithy file, in test-models/validation-test.smithy
.
namespace org.example.smithy
structure MyStructure {
known: String,
wrongType: SomeOperation,
}
operation SomeOperation {
input: SomeService
}
service SomeService {
version: "1.0",
operations: [MyStructure]
}
The following issues will be output when the validation runs.
> cargo
Example Documentation
> cargo
}}
}}
=
() ) ==
|=Trait|=Value|
|||
() ) ==
() ) ==
===
Changes
Version 0.2.6
- Added parameters 'default_search_env' and 'search_env' to control the model assembler.
Version 0.2.5
- Implemented cargo-atelier's lint and validate should work on models built from multiple namespace
files using the model assembler.
- Updated all commands to take a list of file paths as input, the assembler will figure out the file types.
- Updated error reporting.
Version 0.2.4
- Change to lib API.
Version 0.2.3
- Fixed: bumped somedoc dependency version.
Version 0.2.2
- Made new command for documentation writer; this takes the
somedoc::write::OutputFormat
to select format.
Version 0.2.1
- Changes based on new core traits
HasIdentity
andHasTraits
. - Added documentation writer.
Version 0.1.3
- Supporting colorized output.
- Added example files for lint/validate tests.
- Added examples here.
Version 0.1.2
- Updated library dependency to get the latest Smithy reader.
Version 0.1.1
- Linter and Validator commands working
- Convert from json/smithy to json/smithy/uml
Version 0.1.0
- Placeholder release.
TODO
- Validator.
- Code generator.