-
- Downloads
Implement `@length` on collections (#2028)
* Refactor `ConstrainedMapGenerator` slightly * Add `@length` list operation in `constraints.smithy` * Add more setup required for rendering constraint `list`s * Add initial draft of `ConstrainedCollectionGenerator` * Add license header to `LengthTraitCommon` * Add draft of collection constraint violation generation Copy `MapCostraintViolationGenerator` into `CollectionConstraintViolationGenerator` for now. * Add `Visibility.toRustQualifier` * Implement `CollectionConstraintViolationGenerator` * Use `TraitInfo` on `CollectionConstraintViolationGenerator` * Update docs on `ConstrainedCollectionGenerator` * Improve formatting on rust code * Don't generate `ConstraintViolation` enum twice * Make symbol provider work with constrained lists * Fix call to `ConstraintViolation::Member` * Render constraint validation functions for lists * Fix call to `usize::to_string` * Use map json customisation for collections as well * Update to use overhauled module system * Add constraint traits check for collection shapes * Remove test checking that `@length` is not used in `list`s * Refactor use of `shape.isDirectlyConstrained` * Fix failing `UnconstrainedCollectionGeneratorTest` test * Fix test * Actually fix the test * Update changelog * Fix `constrainedCollectionCheck` * Add tests for `ConstrainedCollectionGenerator` * Make tests work for when sets are implemented * Remove mention of `set` in changelog Co-authored-by:david-perez <d@vidp.dev> * Fix styling in `constraints.smithy` Co-authored-by:
david-perez <d@vidp.dev> * Use `check` instead of `assert` * Grammar fix in comment about `Option<Box<_>>` * Rename unsupported length data class for blobs - `UnsupportedLengthTraitOnCollectionOrOnBlobShape` -> `UnsupportedLengthTraitOnBlobShape` * Add TODO about `uniqueItems` not being implemented yet * Change error message: `unconstrained` -> `not constrained` * Add imports to fix docs * Remove unused `modelsModuleWriter` parameter * Use `filterIsInstance` and coalesce `filter + map` * Add `check` in json customization * Use `Set` instead of `List` for supported contraints * Use `toMutableList` to avoid creating an extra list * Add `@length` list to `ConA` * Add `@httpQuery`-bound `@length` list example * Add `@httpHeader`-bound `@length` list * Fix `UnconstrainedCollectionGeneratorTest` test * Fix rendering of constrained lists as header values * Split very long line * Add docs for `ConstraintViolation::Member` for lists * Pass `length` variable name to `LengthTrait.rustCondition` * Refactor long conditional * Homogenise conditional Co-authored-by:
david-perez <d@vidp.dev>
Showing
- CHANGELOG.next.toml 2 additions, 1 deletionCHANGELOG.next.toml
- codegen-core/common-test-models/constraints.smithy 46 additions, 2 deletionscodegen-core/common-test-models/constraints.smithy
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt 17 additions, 1 deletion...ware/amazon/smithy/rust/codegen/core/rustlang/RustType.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolVisitor.kt 1 addition, 1 deletion...e/amazon/smithy/rust/codegen/core/smithy/SymbolVisitor.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/http/HttpBindingGenerator.kt 8 additions, 1 deletion...degen/core/smithy/generators/http/HttpBindingGenerator.kt
- codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/JsonSerializerGenerator.kt 7 additions, 4 deletions...ore/smithy/protocols/serialize/JsonSerializerGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ConstrainedShapeSymbolProvider.kt 19 additions, 8 deletions...t/codegen/server/smithy/ConstrainedShapeSymbolProvider.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/Constraints.kt 23 additions, 8 deletions...e/amazon/smithy/rust/codegen/server/smithy/Constraints.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/PubCrateConstrainedShapeSymbolProvider.kt 1 addition, 1 deletion...n/server/smithy/PubCrateConstrainedShapeSymbolProvider.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt 40 additions, 15 deletions...smithy/rust/codegen/server/smithy/ServerCodegenVisitor.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/UnconstrainedShapeSymbolProvider.kt 1 addition, 1 deletion...codegen/server/smithy/UnconstrainedShapeSymbolProvider.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt 10 additions, 19 deletions...t/codegen/server/smithy/ValidateUnsupportedConstraints.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/customizations/BeforeIteratingOverMapOrCollectionJsonCustomization.kt 8 additions, 5 deletions...ns/BeforeIteratingOverMapOrCollectionJsonCustomization.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/CollectionConstraintViolationGenerator.kt 106 additions, 0 deletions...ithy/generators/CollectionConstraintViolationGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedCollectionGenerator.kt 230 additions, 0 deletions...erver/smithy/generators/ConstrainedCollectionGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedMapGenerator.kt 6 additions, 18 deletions...degen/server/smithy/generators/ConstrainedMapGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedStringGenerator.kt 2 additions, 9 deletions...en/server/smithy/generators/ConstrainedStringGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/LenghTraitCommon.kt 20 additions, 0 deletions...rust/codegen/server/smithy/generators/LenghTraitCommon.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/UnconstrainedCollectionGenerator.kt 10 additions, 33 deletions...ver/smithy/generators/UnconstrainedCollectionGenerator.kt
- codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/http/ServerResponseBindingGenerator.kt 13 additions, 10 deletions.../smithy/generators/http/ServerResponseBindingGenerator.kt
Loading
Please register or sign in to comment