Skip to content

Commit

Permalink
chore(assertions): misformatted doc string causes generated docs to c…
Browse files Browse the repository at this point in the history
…utoff information #27392 (#31199)

### Issue #27392

Closes #27392

### Reason for this change
Following Comment format,
https://github.com/aws/aws-cdk/blob/aca90272ca65fce47d8de50dc1b2c3ab04132a19/packages/aws-cdk-lib/assertions/lib/template.ts#L183

creates this following format in **.jsii** assembly
```
              "docs": {
                "remarks": "Provide '*' to match all parameters in the template.",
                "summary": "the name of the parameter."
              },
```
**Remarks** section is created by **jsii**, when **`@remarks`** is mentioned or it takes anything after first paragraph. (after first **`dot`**)
Reference:
https://github.com/aws/jsii/blob/50e6c47fb873fab894e3779bafb0e84c31287839/packages/%40jsii/spec/src/assembly.ts#L313-L321

### Decision on approach
1. fix it from **jsii / from our documentation portal side**, by modifying configuration to show remarks also in portal.
2. convert this detail as summary by keeping it in first paragraph. [This PR implements this]

### Description of changes
Changed 
```
@param logicalId the name of the parameter. Provide `'*'` to match all parameters in the template.
```
To, NOTE, **. P** --> **, p**
```
@param logicalId the name of the parameter, provide `'*'` to match all parameters in the template.
```

### Description of how you validated changes
1. `$ npx lerna run build --scope=aws-cdk-lib --skip-nx-cache`
1. Ran build inside **aws-cdk-lib** --> `username@aws-cdk-lib$ yarn build`, this created .jsii file with compressed form.
1. Now ran **yarn jsii** --> this uncompresses **.jsii** file and creates exact doc content inside **.jsii** file.
1. Checked, everything is placed inside **summary**

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
stm29 authored Aug 23, 2024
1 parent aca9027 commit c629172
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions packages/aws-cdk-lib/assertions/lib/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Annotations {
/**
* Assert that an error with the given message exists in the synthesized CDK `Stack`.
*
* @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template.
* @param constructPath the construct path to the error, provide `'*'` to match all errors in the template.
* @param message the error message as should be expected. This should be a string or Matcher object.
*/
public hasError(constructPath: string, message: any): void {
Expand All @@ -38,7 +38,7 @@ export class Annotations {
/**
* Assert that an error with the given message does not exist in the synthesized CDK `Stack`.
*
* @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template.
* @param constructPath the construct path to the error, provide `'*'` to match all errors in the template.
* @param message the error message as should be expected. This should be a string or Matcher object.
*/
public hasNoError(constructPath: string, message: any): void {
Expand All @@ -51,7 +51,7 @@ export class Annotations {
/**
* Get the set of matching errors of a given construct path and message.
*
* @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template.
* @param constructPath the construct path to the error, provide `'*'` to match all errors in the template.
* @param message the error message as should be expected. This should be a string or Matcher object.
*/
public findError(constructPath: string, message: any): SynthesisMessage[] {
Expand All @@ -61,7 +61,7 @@ export class Annotations {
/**
* Assert that an warning with the given message exists in the synthesized CDK `Stack`.
*
* @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template.
* @param constructPath the construct path to the warning, provide `'*'` to match all warnings in the template.
* @param message the warning message as should be expected. This should be a string or Matcher object.
*/
public hasWarning(constructPath: string, message: any): void {
Expand All @@ -74,7 +74,7 @@ export class Annotations {
/**
* Assert that an warning with the given message does not exist in the synthesized CDK `Stack`.
*
* @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template.
* @param constructPath the construct path to the warning, provide `'*'` to match all warnings in the template.
* @param message the warning message as should be expected. This should be a string or Matcher object.
*/
public hasNoWarning(constructPath: string, message: any): void {
Expand All @@ -87,7 +87,7 @@ export class Annotations {
/**
* Get the set of matching warning of a given construct path and message.
*
* @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template.
* @param constructPath the construct path to the warning, provide `'*'` to match all warnings in the template.
* @param message the warning message as should be expected. This should be a string or Matcher object.
*/
public findWarning(constructPath: string, message: any): SynthesisMessage[] {
Expand All @@ -97,7 +97,7 @@ export class Annotations {
/**
* Assert that an info with the given message exists in the synthesized CDK `Stack`.
*
* @param constructPath the construct path to the info. Provide `'*'` to match all info in the template.
* @param constructPath the construct path to the info, provide `'*'` to match all info in the template.
* @param message the info message as should be expected. This should be a string or Matcher object.
*/
public hasInfo(constructPath: string, message: any): void {
Expand All @@ -110,7 +110,7 @@ export class Annotations {
/**
* Assert that an info with the given message does not exist in the synthesized CDK `Stack`.
*
* @param constructPath the construct path to the info. Provide `'*'` to match all info in the template.
* @param constructPath the construct path to the info, provide `'*'` to match all info in the template.
* @param message the info message as should be expected. This should be a string or Matcher object.
*/
public hasNoInfo(constructPath: string, message: any): void {
Expand All @@ -123,7 +123,7 @@ export class Annotations {
/**
* Get the set of matching infos of a given construct path and message.
*
* @param constructPath the construct path to the info. Provide `'*'` to match all infos in the template.
* @param constructPath the construct path to the info, provide `'*'` to match all infos in the template.
* @param message the info message as should be expected. This should be a string or Matcher object.
*/
public findInfo(constructPath: string, message: any): SynthesisMessage[] {
Expand Down
16 changes: 8 additions & 8 deletions packages/aws-cdk-lib/assertions/lib/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class Template {
* Assert that a Parameter with the given properties exists in the CloudFormation template.
* By default, performs partial matching on the parameter, via the `Match.objectLike()`.
* To configure different behavior, use other matchers in the `Match` class.
* @param logicalId the name of the parameter. Provide `'*'` to match all parameters in the template.
* @param logicalId the name of the parameter, provide `'*'` to match all parameters in the template.
* @param props the parameter as should be expected in the template.
*/
public hasParameter(logicalId: string, props: any): void {
Expand All @@ -180,7 +180,7 @@ export class Template {

/**
* Get the set of matching Parameters that match the given properties in the CloudFormation template.
* @param logicalId the name of the parameter. Provide `'*'` to match all parameters in the template.
* @param logicalId the name of the parameter, provide `'*'` to match all parameters in the template.
* @param props by default, matches all Parameters in the template.
* When a literal object is provided, performs a partial match via `Match.objectLike()`.
* Use the `Match` APIs to configure a different behaviour.
Expand All @@ -193,7 +193,7 @@ export class Template {
* Assert that an Output with the given properties exists in the CloudFormation template.
* By default, performs partial matching on the resource, via the `Match.objectLike()`.
* To configure different behavior, use other matchers in the `Match` class.
* @param logicalId the name of the output. Provide `'*'` to match all outputs in the template.
* @param logicalId the name of the output, provide `'*'` to match all outputs in the template.
* @param props the output as should be expected in the template.
*/
public hasOutput(logicalId: string, props: any): void {
Expand All @@ -205,7 +205,7 @@ export class Template {

/**
* Get the set of matching Outputs that match the given properties in the CloudFormation template.
* @param logicalId the name of the output. Provide `'*'` to match all outputs in the template.
* @param logicalId the name of the output, provide `'*'` to match all outputs in the template.
* @param props by default, matches all Outputs in the template.
* When a literal object is provided, performs a partial match via `Match.objectLike()`.
* Use the `Match` APIs to configure a different behaviour.
Expand All @@ -218,7 +218,7 @@ export class Template {
* Assert that a Mapping with the given properties exists in the CloudFormation template.
* By default, performs partial matching on the resource, via the `Match.objectLike()`.
* To configure different behavior, use other matchers in the `Match` class.
* @param logicalId the name of the mapping. Provide `'*'` to match all mappings in the template.
* @param logicalId the name of the mapping, provide `'*'` to match all mappings in the template.
* @param props the output as should be expected in the template.
*/
public hasMapping(logicalId: string, props: any): void {
Expand All @@ -230,7 +230,7 @@ export class Template {

/**
* Get the set of matching Mappings that match the given properties in the CloudFormation template.
* @param logicalId the name of the mapping. Provide `'*'` to match all mappings in the template.
* @param logicalId the name of the mapping, provide `'*'` to match all mappings in the template.
* @param props by default, matches all Mappings in the template.
* When a literal object is provided, performs a partial match via `Match.objectLike()`.
* Use the `Match` APIs to configure a different behaviour.
Expand All @@ -243,7 +243,7 @@ export class Template {
* Assert that a Condition with the given properties exists in the CloudFormation template.
* By default, performs partial matching on the resource, via the `Match.objectLike()`.
* To configure different behavior, use other matchers in the `Match` class.
* @param logicalId the name of the mapping. Provide `'*'` to match all conditions in the template.
* @param logicalId the name of the mapping, provide `'*'` to match all conditions in the template.
* @param props the output as should be expected in the template.
*/
public hasCondition(logicalId: string, props: any): void {
Expand All @@ -255,7 +255,7 @@ export class Template {

/**
* Get the set of matching Conditions that match the given properties in the CloudFormation template.
* @param logicalId the name of the condition. Provide `'*'` to match all conditions in the template.
* @param logicalId the name of the condition, provide `'*'` to match all conditions in the template.
* @param props by default, matches all Conditions in the template.
* When a literal object is provided, performs a partial match via `Match.objectLike()`.
* Use the `Match` APIs to configure a different behaviour.
Expand Down

0 comments on commit c629172

Please sign in to comment.