Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(clients): codegen for structural hint documentation in commands #4573

Merged
merged 2 commits into from
Mar 24, 2023

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Mar 24, 2023

Issue

smithy-lang/smithy-typescript#723

Description

This adds structural hints to the input types of each command in the form of JSDoc.

Testing

code generation

  • rerun codegen for all clients prior to release and after upstream approval

@kuhe kuhe force-pushed the feat/structural_hints branch 2 times, most recently from 52171f7 to 017dcfb Compare March 24, 2023 16:22
@kuhe
Copy link
Contributor Author

kuhe commented Mar 24, 2023

Edge case example DynamoDB:

/**
 * const input = {
 *   TransactItems: [ // required
 *     {
 *       ConditionCheck: {
 *         Key: { // required
 *           "<keys>": { // Union: only one key present
 *             S: "STRING_VALUE",
 *             N: "STRING_VALUE",
 *             B: "BLOB_VALUE",
 *             SS: [
 *               "STRING_VALUE",
 *             ],
 *             NS: [
 *               "STRING_VALUE",
 *             ],
 *             BS: [
 *               "BLOB_VALUE",
 *             ],
 *             M: {
 *               "<keys>": { // Union: only one key present
 *                 S: "STRING_VALUE",
 *                 N: "STRING_VALUE",
 *                 B: "BLOB_VALUE",
 *                 SS: [
 *                   "STRING_VALUE",
 *                 ],
 *                 NS: [
 *                   "STRING_VALUE",
 *                 ],
 *                 BS: [
 *                   "BLOB_VALUE",
 *                 ],
 *                 M: {
 *                   "<keys>": "<AttributeValue>"
 *                 },
 *                 L: [
 *                   { // Union: only one key present
 *                     S: "<AttributeValue>"
 *                     N: "<AttributeValue>"
 *                     B: "<AttributeValue>"
 *                     SS: "<AttributeValue>"
 *                     NS: "<AttributeValue>"
 *                     BS: "<AttributeValue>"
 *                     M: "<AttributeValue>"
 *                     L: [
 *                       { // Union: only one key present
 *                         S: "<AttributeValue>"
 *                         N: "<AttributeValue>"
 *                         B: "<AttributeValue>"
 *                         SS: "<AttributeValue>"
 *                         NS: "<AttributeValue>"
 *                         BS: "<AttributeValue>"
 *                         M: "<AttributeValue>"
 *                         L: "<AttributeValue>"
 *                         NULL: true || false,
 *                         BOOL: true || false,
 *                       }
 *                     ],
 *                     NULL: true || false,
 *                     BOOL: true || false,
 *                   }
 *                 ],
 *                 NULL: "<AttributeValue>"
 *                 BOOL: "<AttributeValue>"
 *               }
 *             },
 *             L: "<AttributeValue>"
 *             NULL: "<AttributeValue>"
 *             BOOL: "<AttributeValue>"
 *           }
 *         },
 *         TableName: "STRING_VALUE", // required
 *         ConditionExpression: "STRING_VALUE", // required
 *         ExpressionAttributeNames: {
 *           "<keys>": "STRING_VALUE",
 *         },
 *         ExpressionAttributeValues: {
 *           "<keys>": "<AttributeValue>"
 *         },
 *         ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE"
 *       }
 *       Put: {
 *         Item: { // required
 *           "<keys>": "<AttributeValue>"
 *         },
 *         TableName: "STRING_VALUE", // required
 *         ConditionExpression: "STRING_VALUE",
 *         ExpressionAttributeNames: {
 *           "<keys>": "STRING_VALUE",
 *         },
 *         ExpressionAttributeValues: {
 *           "<keys>": "<AttributeValue>"
 *         },
 *         ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE"
 *       }
 *       Delete: {
 *         Key: { // required
 *           "<keys>": "<AttributeValue>"
 *         },
 *         TableName: "STRING_VALUE", // required
 *         ConditionExpression: "STRING_VALUE",
 *         ExpressionAttributeNames: {
 *           "<keys>": "STRING_VALUE",
 *         },
 *         ExpressionAttributeValues: {
 *           "<keys>": "<AttributeValue>"
 *         },
 *         ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE"
 *       }
 *       Update: {
 *         Key: { // required
 *           "<keys>": "<AttributeValue>"
 *         },
 *         UpdateExpression: "STRING_VALUE", // required
 *         TableName: "STRING_VALUE", // required
 *         ConditionExpression: "STRING_VALUE",
 *         ExpressionAttributeNames: {
 *           "<keys>": "STRING_VALUE",
 *         },
 *         ExpressionAttributeValues: {
 *           "<keys>": "<AttributeValue>"
 *         },
 *         ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE"
 *       }
 *     }
 *   ],
 *   ReturnConsumedCapacity: "INDEXES" || "TOTAL" || "NONE"
 *   ReturnItemCollectionMetrics: "SIZE" || "NONE"
 *   ClientRequestToken: "STRING_VALUE",
 * }
 * */

@kuhe kuhe force-pushed the feat/structural_hints branch 4 times, most recently from b6fc4c9 to 6d14f81 Compare March 24, 2023 17:56
@kuhe kuhe force-pushed the feat/structural_hints branch from 6d14f81 to 145df02 Compare March 24, 2023 19:52
@kuhe kuhe marked this pull request as ready for review March 24, 2023 19:54
@kuhe kuhe requested a review from a team as a code owner March 24, 2023 19:54
@kuhe kuhe merged commit b3ff58d into aws:main Mar 24, 2023
@kuhe kuhe deleted the feat/structural_hints branch March 24, 2023 20:34
@github-actions
Copy link

github-actions bot commented Apr 8, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants