Commit Graph

145 Commits

Author SHA1 Message Date
Russell Cohen 48b4ef6a32
Generated Combined Error Shapes (#71)
* Add combined error generator

* Deterministic operation generation

* Test generator refactoring

* Fix test failure in inlineable

* Back out needless changes to Rust.kt and merge error types

* Add some docs
2020-12-07 16:56:30 -05:00
Russell Cohen 075d40949a
Deterministic operation generation (#70) 2020-12-04 14:50:54 -05:00
Russell Cohen 6676583bca
Change default Smithy expression start character to # (#67) 2020-12-02 18:05:42 -05:00
Russell Cohen 0b6ecac6d5
Update README.md (#58) 2020-12-01 16:45:31 -05:00
Russell Cohen 97b47adb8b
Add non_exhaustive to structs, unions, and enums (#59)
* Add non_exhaustive to structs, unions, and enums

During a refactoring, `non_exhaustive` was accidentally removed from generated structurs. This commit re-adds it and validates its present with tests.

* Remove print

* Delete empty test
2020-12-01 16:45:04 -05:00
Russell Cohen 7954752a75
Cleanups (#56)
* Use impl trait

* Output shapes should also be in operations

* Move test-only function into tests
2020-11-25 19:09:32 -05:00
Russell Cohen d89d58caf3
Add support for deserializing bodies (except special shapes) (#57)
* Add support for deserializing bodies

* Don't mark top level shapes as serializable

* Use positional formatters to shorten code in a few spots
2020-11-25 18:58:29 -05:00
Russell Cohen efdca4484c
Add uuidv4 implementation & rust-runtime as JAR (#55)
* Add uuidv4 implementation & rust-runtime as JAR

* Add inlineable crate

* Flesh out dependency test
2020-11-25 18:49:38 -05:00
Russell Cohen 5af7fc0bc9
Dynamo update (#54)
* Use the new Dynamo DB model

* Convert Vec<T> to [T] when generating formatters
2020-11-24 19:03:53 -05:00
Russell Cohen 32b55125be
wip (#51) 2020-11-24 16:06:00 -05:00
Russell Cohen be16c2f225
Generate documentation for structures (#47)
* Generate documentation for structures

The first of many commits to generate docs. This is a first pass for structures, we still need to document enums & unions. Some serious design also needs to occur to figure out the best practice for turning the Smithy documentation into nice Rust documentation.

* Bump Java version to 9

* Remove exclusion of `target`

* Don't build docs for deps

* Update to use getMemberTrait
2020-11-24 11:26:11 -05:00
Russell Cohen 8884657c3a
Only write the header warning once per file (#49) 2020-11-23 15:46:01 -05:00
Russell Cohen 9609cc3a58
Support the remaining fields on request protocol tests (#50)
* Support the remaining fields on request protocol tests

Add support for remaining requirements and & make some small changes to support them.

* Satisfy rustfmt
2020-11-23 14:32:15 -05:00
Russell Cohen 6011a0fd46
Upgrade Smithy to 1.4.0 & fix Instantiator (#48)
Upgrade Smithy to 1.4.0. This enables us to re-enable the invalid protocol tests for 1.3.0. Along the way, `Instantiator` was refactored to cleanup its handling of `Optional` shapes.
2020-11-23 12:21:46 -05:00
Russell Cohen e171459643
Update to Rust 1.48.0 (#46) 2020-11-20 15:45:32 -05:00
Russell Cohen 2f2a9517d0
Support Serialization via Serde Annotations (#40)
* Refactor SymbolMetadataProvider into an abstract class

* Refactor meta to expectMeta

* Refactor SymbolMetadataProvider into an abstract class

* Refactor meta to expectMeta

* Add support for inline dependencies

* Implement Json Serializers!

* CR fixes
2020-11-20 15:41:45 -05:00
Russell Cohen 5014e625cb
Switch to BTreeSet to provide deterministic serialization (#42)
HashSet does not offer a deterministic iteration order which made serialization non-deterministic. The change to BTreeSet is otherwise transparent but provides deterministic sort order for members.
2020-11-19 15:23:42 -05:00
Russell Cohen 16e513bd5d
Pin Rust version & fix lint error (#41)
Every 6 weeks, a new version of Rust and Clippy comes out—we were upgrading implicitly which meant that our clippy (lint) checks started failing if they added new lints. This makes the Rust version explicit so we can upgrade and fix lints on our schedule.
2020-11-19 13:58:38 -05:00
Russell Cohen 555021e36b
Expand protocol tests for RestJson1.1 and AwsRestJson (#38)
* Add document types & other bug fixes to support AwsJson11

* Expand protocol tests for RestJson1.1 and AwsRestJson

This diff adds RestJson1 and AwsJson1.1 to the integration test suite. It uncovered a number of bugs, some of which I fixed inline and some I filed issues for and disabled the tests.

* Add another disabled test & cleaup

* Fix tests broken by changing URL encoding to encode ':'

* Copy-paste Aarons comment

* Fixup Rustfmt
2020-11-18 15:13:12 -05:00
Russell Cohen a3dbb5e356
Use `.of()` to construct Knowledge Indices (#39)
`.of()` will use a cached index on the model when it exists
2020-11-18 13:20:15 -05:00
Russell Cohen 7e580f64f8
Generate builders for recursive shapes (#33) 2020-11-17 17:55:20 -05:00
Russell Cohen a6ce8395d5
Support recursive shapes (#32)
* Support recursive shapes

* Fix doc typo

* Update comments some more
2020-11-17 12:58:55 -05:00
Russell Cohen 4f327bc1c9
Generate request body struct (#30)
* Run all tests in the same cargo workspace

Running all the tests in the same cargo workspace allows test runners to avoid recompiling dependencies every time. This allows us to drop parallel tests which seemed to be causing OOMs.

* Doc cleanups and improvements

* Add support for public and private modules

* Generate Synthetic Body structs for serialization

To enable serialization & deserialization, we generate synthetic structs representing the request body. Currently, the serialization method returns a stub, however, in a subsequent PR, serde will be used to generate actual request bodies.

* Fix doc typo

* CR feedback
2020-11-17 11:39:40 -05:00
Russell Cohen 33705fa3c7
Run all tests in the same cargo workspace (#28)
* Run all tests in the same cargo workspace

Running all the tests in the same cargo workspace allows test runners to avoid recompiling dependencies every time. This allows us to drop parallel tests which seemed to be causing OOMs.

* Doc cleanups and improvements
2020-11-17 11:35:30 -05:00
Russell Cohen dfe42b73d8
Refactor generation to use unified Meta (#26)
* Refactor generation to use unified Meta

A `Meta` object is introduced that is attached during Symbol generation. This configures the visibility and attributes that the generators should use when generating structs/unions/etc. This is a refactoring to setup the next set of PRs which will generate serializers for models via the same mechanism.

* Cleanup SymbolVisitor cruft
2020-11-15 19:43:37 -05:00
Russell Cohen 56ee9c52e9
ProtocolConfig Refactoring (#25)
Mostly mechanical refactoring to remove operation specific fields from ProtocolConfig—this allows protocol config to be used for an entire service rather than being recreated for each operation.
2020-11-13 21:27:20 -05:00
Russell Cohen 31cfbf573c
Fix blob instantiation code for protocol tests (#24)
* Fix blob instantiation code for protocol tests

* Update Instantiator.kt

clarify comment
2020-11-13 21:01:15 -05:00
Russell Cohen 0485063890
Support dependency features (#23)
* Support dependency features

* Fix typo
2020-11-13 20:50:14 -05:00
Russell Cohen c7d4c0316e
Add Body Validation Support to Protocol Test Helpers (#21)
* Use thiserror to make prettier errors

* Add body validation support

* Fixes for clippy
2020-11-12 13:55:48 -05:00
Russell Cohen b27ce8b7dd
Fix escaping bug (#19) 2020-11-12 12:56:20 -05:00
Russell Cohen 9707c0347a
Increase scope of Protocol test generation (#18)
* Setup pre-commit

* Run precommit hook across all files

* Increase scope of Protocol test generaton

Added support for the following fields in protocol tests:
- forbidQueryParams
- requireQueryParams
- headers
2020-11-04 22:20:50 -05:00
Russell Cohen 86dc5db504
Add pre-commit hooks (#17)
* Setup pre-commit

* Run precommit hook across all files

* Update README.md
2020-11-04 22:09:00 -05:00
Russell Cohen 1d30ad06ca
Add initial protocol test generation (#16)
* Implement Instantiator

* Add support for dev-dependencies

* Pass the protocol in Protocol config

* Add initial protocol test generator

This commit adds an initial and very limited implementation of protocol test generation. Specifically,
it only asserts that the query string contains certain required parameters. We will update protocol test generation in concert with updates to the code generation features.

* Fixes from integration tests

* Add test of recursive maps, fix implementation of empty maps

* Add protocol test generator, pre-commit hooks

* Fix test

* Fix formatting
2020-11-04 11:17:19 -05:00
Russell Cohen 44720f4dc0
Productionize Integration Test Machinery (#15)
* Productionize Integration Test Machinery

smithy-build.json is now dynamically generated along with a Cargo.toml to facilitate easy adding of new integration tests.

* We don't need REPO_ROOT anymore
2020-11-03 18:44:38 -05:00
Russell Cohen 787d317850
Fix RustWrite.withModule bug (#13)
* withModule needs to set the parent dependencies

* Fix ktlin style
2020-11-02 15:37:29 -05:00
Russell Cohen 9983057a4b
Add inital CI workflow (#12)
* Add inital CI workflow

* Run unit tests

* Run integration tests & ktlint

* Split job, set REPO_ROOT

* Update to satisfy new cargo clippy

* Upload an artifact

* Run runtime tests in CI

* Add missing test.sh

* Make script path indepdendent

* Run clippy on Rust runtime

* move artifact upload to the correct job

* Don't upload target

* Fix Rust code formatting

* Fix kotlin codestyle

* Fix merge issue
2020-11-02 15:30:04 -05:00
Russell Cohen 6e772b9d60
Generate Builders for Structures (#3)
A builder object is generated for Structure shapes. The builder will be fallible (return `Result<T, String>`) if the structure has required members without defaults.

If the structure has no required members, the `build()` method directly returns the constructed object. This required a number of refinements to our module handling as the builders are namespaced to 1-module-per-shape.
2020-11-02 14:03:40 -05:00
Russell Cohen 4557f6a6bb
Add protocol test helpers (#11)
* Add protocol test helpers

* expand tests
2020-11-02 14:03:21 -05:00
Russell Cohen 972d833c28
Add base64::decode & property testing (#4)
To support protocol tests, this commit adds `decode` to our base64 implementation. The implementation is validated against the base64 crate and stress-tested with proptest for correctness and crash-free-ness.
2020-11-02 12:27:35 -05:00
Russell Cohen 2d71e48957
Add support for unnamed enumerations (#2)
* Add support for unnamed enumerations

Unnamed enumerations are supported by creating a "newtype" that wraps the string. The newtype provides the valid values as a list for convenience.

* Take intellij's suggestion to simplify

* Rename function to values()
2020-10-30 14:06:22 -04:00
Russell Cohen ddac680d53
Partial HTTP protocol implementation (#1)
* Add new models to run integration tests against

* Add initial support for HTTP protocols

* Refactor protocol generation arguments

* Add more method comments

* Remove some dead code

* CR feedback
2020-10-29 15:49:22 -04:00
Russell Cohen 4874168a9b Add Rust runtime code 2020-10-28 11:08:23 -04:00
Russell Cohen 5c77e437be Add gradle files 2020-10-28 11:01:13 -04:00
Russell Cohen 3ba6fe37e7 Add Kotlin codegen 2020-10-28 11:00:49 -04:00
Amazon GitHub Automation 2f8227c6bf Initial commit 2020-10-28 06:37:45 -07:00