Skip to content

Implement crude server validation#557

Merged
adwsingh merged 1 commit intomainfrom
server-validation-simple
Jan 15, 2025
Merged

Implement crude server validation#557
adwsingh merged 1 commit intomainfrom
server-validation-simple

Conversation

@adwsingh
Copy link
Contributor

Issue #, if available:

Description of changes:

This is a basic and crude server validation that is meant to be a stopgap till #546 is merged.

Tested it manually,

❯ curl -i -X POST http://localhost:8080/add-beer -H 'Content-Type: application/json' -d '{}'
HTTP/1.1 400 Bad Request
x-amzn-errortype: smithy.framework#MalformedRequestException
content-length: 46
content-type: application/json

{"message":"Missing required members: [beer]"}%
❯ curl -i -X POST http://localhost:8080/add-beer -H 'Content-Type: application/json' -d '{"beer":{"name":"a"}}'
HTTP/1.1 400 Bad Request
x-amzn-errortype: smithy.framework#ValidationException
x-amzn-errortype: smithy.framework#ValidationException
content-length: 123
content-type: application/json

{"message":"1 validation error(s) detected.Value with length 1 must have length greater than or equal to 3 at /beer/name;"}%

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@adwsingh adwsingh force-pushed the server-validation-simple branch from 6087efc to 6192156 Compare January 14, 2025 20:51
@adwsingh adwsingh force-pushed the server-validation-simple branch from 6192156 to f0716ab Compare January 14, 2025 23:15
@adwsingh adwsingh enabled auto-merge (rebase) January 15, 2025 06:12
@adwsingh adwsingh merged commit 1bd2e56 into main Jan 15, 2025
3 checks passed
@mtdowling mtdowling deleted the server-validation-simple branch February 5, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants