smithy-lang / smithy-kotlin

Smithy code generator for Kotlin (in development)
Apache License 2.0
78 stars 26 forks source link

Fix comment escaping #94

Closed kggilmer closed 3 years ago

kggilmer commented 3 years ago

In some places comment text causes a comment to become untemrinated, resulting in the rest of the file being parsed as a comment.

Example: service: Apigatewayv2 class CreateApiRequest

/**
     * <p>A CORS configuration. Supported only for HTTP APIs. See <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html">Configuring CORS</a> for more information.</p>
     */
    val corsConfiguration: Cors? = builder.corsConfiguration
    /**
     * <p>This property is part of quick create. It specifies the credentials required for the integration, if any. For a Lambda integration, three options are available. To specify an IAM Role for API Gateway to assume, use the role's Amazon Resource Name (ARN). To require that the caller's identity be passed through from the request, specify arn:aws:iam::*:user/*. To use resource-based permissions on supported AWS services, specify null. Currently, this property is not used for HTTP integrations. Supported only for HTTP APIs.</p>
     */
    val credentialsArn: String? = builder.credentialsArn
    /**
     * <p>The description of the API.</p>
     */
    val description: String? = builder.description

internal id: 176971894

kggilmer commented 3 years ago

Another case in glacier, UploadMultipartPartInput:


    /**
     * <p>Identifies the range of bytes in the assembled archive that will be uploaded in this
     *          part. Amazon S3 Glacier uses this information to assemble the archive in the proper sequence.
     *          The format of this header follows RFC 2616. An example header is Content-Range:bytes
     *          0-4194303/*.</p>
     */
    val range: String? = builder.range
``` (Ken Gilmer - Feb 17, 2021)
kggilmer commented 3 years ago

Another case is in quicksight, in the generation of the service client:

    /**
     * <p>Lists all of the datasets belonging to the current AWS account in an AWS Region.</p>
     *             <p>The permissions resource is <code>arn:aws:quicksight:region:aws-account-id:dataset/*</code>.</p>
     */
    suspend fun listDataSets(input: ListDataSetsRequest): ListDataSetsResponse

and

    /**
     * <p>Lists all of the datasets belonging to the current AWS account in an AWS Region.</p>
     *             <p>The permissions resource is <code>arn:aws:quicksight:region:aws-account-id:dataset/*</code>.</p>
     */
    override suspend fun listDataSets(input: ListDataSetsRequest): ListDataSetsResponse {

(Ken Gilmer - Feb 17, 2021)

kggilmer commented 3 years ago

Another case is lexruntimeservice in the aws.sdk.kotlin.lexruntimeservice.model.PostContentRequest type:


    /**
     * <p> You pass this value as the <code>Accept</code> HTTP header. </p>
     *          <p> The message Amazon Lex returns in the response can be either text or speech based on the
     *         <code>Accept</code> HTTP header value in the request. </p>
     *          <ul>
     *             <li>
     *                <p> If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex returns text in the
     *           response. </p>
     *             </li>
     *             <li>
     *                <p> If the value begins with <code>audio/</code>, Amazon Lex returns speech in the response.
     *           Amazon Lex uses Amazon Polly to generate the speech (using the configuration you specified in the
     *             <code>Accept</code> header). For example, if you specify <code>audio/mpeg</code> as the
     *           value, Amazon Lex returns speech in the MPEG format.</p>
     *             </li>
     *             <li>
     *                <p>If the value is <code>audio/pcm</code>, the speech returned is <code>audio/pcm</code>
     *           in 16-bit, little endian format.
     *           </p>
     *             </li>
     *             <li>
     *                <p>The following are the accepted values:</p>
     *                <ul>
     *                   <li>
     *                      <p>audio/mpeg</p>
     *                   </li>
     *                   <li>
     *                      <p>audio/ogg</p>
     *                   </li>
     *                   <li>
     *                      <p>audio/pcm</p>
     *                   </li>
     *                   <li>
     *                      <p>text/plain; charset=utf-8</p>
     *                   </li>
     *                   <li>
     *                      <p>audio/ (defaults to mpeg)</p>
     *                   </li>
     *                </ul>
     *             </li>
     *          </ul>
     */
    val accept: String? = builder.accept
``` (Ken Gilmer - Feb 17, 2021)
kggilmer commented 3 years ago

Another case is swf. Example:


    /**
     * <p>Returns the list of domains registered in the account. The results may be split into
     *       multiple pages. To retrieve subsequent pages, make the call again using the nextPageToken
     *       returned by the initial call.</p>
     *          <note>
     *             <p>This operation is eventually consistent. The results are best effort and may not
     *         exactly reflect recent updates and changes.</p>
     *          </note>
     *          <p>
     *             <b>Access Control</b>
     *          </p>
     *          <p>You can use IAM policies to control this action's access to Amazon SWF resources as
     *       follows:</p>
     *          <ul>
     *             <li>
     *                <p>Use a <code>Resource</code> element with the domain name to limit the action to
     *           only specified domains. The element must be set to
     *             <code>arn:aws:swf::AccountID:domain/*</code>, where <i>AccountID</i> is
     *           the account ID, with no dashes.</p>
     *             </li>
     *             <li>
     *                <p>Use an <code>Action</code> element to allow or deny permission to call this
     *           action.</p>
     *             </li>
     *             <li>
     *                <p>You cannot use an IAM policy to constrain this action's parameters.</p>
     *             </li>
     *          </ul>
     *          <p>If the caller doesn't have sufficient permissions to invoke the action, or the
     *       parameter values fall outside the specified constraints, the action fails. The associated
     *       event attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>.
     *       For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using IAM to Manage Access to Amazon SWF
     *         Workflows</a> in the <i>Amazon SWF Developer Guide</i>.</p>
     */
    override suspend fun listDomains(input: ListDomainsInput): DomainInfos {
``` (Ken Gilmer - Feb 17, 2021)
kggilmer commented 3 years ago

Also mediastore, example aws.sdk.kotlin.mediastore.model.CorsRule:


    /**
     * <p>One or more response headers that you want users to be able to access from their
     *          applications (for example, from a JavaScript <code>XMLHttpRequest</code> object).</p>
     *          <p>Each CORS rule must have at least one <code>AllowedOrigins</code> element. The string
     *          value can include only one wildcard character (*), for example, http://*.example.com.
     *          Additionally, you can specify only one wildcard character to allow cross-origin access for
     *          all origins.</p>
     */
    val allowedOrigins: List<String>? = builder.allowedOrigins

``` (Ken Gilmer - Feb 17, 2021)
kggilmer commented 3 years ago

also configservice:

aws.sdk.kotlin.configservice.model.ConformancePackDetail:


    /**
     * <p>Conformance pack template that is used to create a pack. The delivery bucket name should start with awsconfigconforms. For example: "Resource": "arn:aws:s3:::your_bucket_name/*".</p>
     */
    val deliveryS3Bucket: String? = builder.deliveryS3Bucket
``` (Ken Gilmer - Feb 17, 2021)
kggilmer commented 3 years ago

also lightsail, example:

aws.sdk.kotlin.lightsail.model.CacheBehaviorPerPath


    /**
     * <p>The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify
     *       wildcard directories (<code>path/to/assets/*</code>), and file types (<code>*.html, *jpg,
     *         *js</code>). Directories and file paths are case-sensitive.</p>
     *          <p>Examples:</p>
     *          <ul>
     *             <li>
     *                <p>Specify the following to cache all files in the document root of an Apache web server
     *           running on a Lightsail instance.</p>
     *                <p>
     *                   <code>var/www/html/</code>
     *                </p>
     *             </li>
     *             <li>
     *                <p>Specify the following file to cache only the index page in the document root of an
     *           Apache web server.</p>
     *                <p>
     *                   <code>var/www/html/index.html</code>
     *                </p>
     *             </li>
     *             <li>
     *                <p>Specify the following to cache only the .html files in the document root of an Apache
     *           web server.</p>
     *                <p>
     *                   <code>var/www/html/*.html</code>
     *                </p>
     *             </li>
     *             <li>
     *                <p>Specify the following to cache only the .jpg, .png, and .gif files in the images
     *           sub-directory of the document root of an Apache web server.</p>
     *                <p>
     *                   <code>var/www/html/images/*.jpg</code>
     *                </p>
     *                <p>
     *                   <code>var/www/html/images/*.png</code>
     *                </p>
     *                <p>
     *                   <code>var/www/html/images/*.gif</code>
     *                </p>
     *                <p>Specify the following to cache all files in the images sub-directory of the document
     *           root of an Apache web server.</p>
     *                <p>
     *                   <code>var/www/html/images/</code>
     *                </p>
     *             </li>
     *          </ul>
     */
    val path: String? = builder.path
```  (Ken Gilmer - Feb 17, 2021)
kggilmer commented 3 years ago

Occurs in glue in CreateCrawlerRequest:


    /**
     * <p>The AWS Glue database where results are written, such as:
     *         <code>arn:aws:daylight:us-east-1::database/sometable/*</code>.</p>
     */
    val databaseName: String? = builder.databaseName
``` (Ken Gilmer - Feb 18, 2021)
kggilmer commented 3 years ago

Frequency of HTML tags occurring in Smithy models


kggilmer@u88a1ad37470a5a:~/dev/repos/aws-models$ find . -name model.json | xargs grep -o "<[^>]*>" | cut -d: -f2 | sort -n | uniq -c | sort
      1 <|.*>
      1 < = >
    108 </dl>
    108 <dl>
     10 </h4>
     10 <h4>
     10 <unique identifier>
      1 < 1/2 *\n      TARGET_TIME_SERIES dataset length</p>
    113 <p class=\"title\">
    119 </ol>
    119 <ol>
     12 < >
      1 <2.0.0</code>
     12 <region>
     13 <my-bucket-name>
 146660 <p>
 146765 </p>
  17972 </a>
     18 </h5>
     18 <h5>
     18 <link  linkend=\"templates-template-name-template-type-versions\">
  19539 </li>
  19539 <li>
      1 <account that owns this container>
      1 <account that owns this\n         container>
      1 <a href=\"AmazonS3/latest/API/API_UploadPart.html\">
      1 <a href=\"AmazonS3/latest/dev/S3onOutposts.html\">
      1 <a href=\"AWSCloudFormation/latest/APIReference/API_DeregisterType.html\">
      1 <a href=\"AWSCloudFormation/latest/UserGuide/modules.html\">
      1 <a href=\"AWSCloudFormation/latest/UserGuide/modules.html#module-ref-resources\">
      1 <a href=\"/kms/latest/developerguide/concepts.html#master_keys\">
      1 <a href=\"sig-v4-authenticating-requests.html\">
      1 <AndAllFilters>
      1 <!-- Any forward slash (\"/\") characters in the <code>
      1 <!-- API Gateway sends back the status code to the caller as the HTTP status code. Parameters and models can be used to transform the response from the method's integration.-->
      1 <api-id>
      1 <aws_account_id>
      1 <AWSRegion>
      1 <= b) is true.</p>
      1 < b) is true.</p>
      1 <bucket>
      1 <BucketLoggingStatus xmlns=\"http
      1 <cluster-id>
      1 <= <code>
      1 <CPUUtilization>
      1 <customer id>
      1 < Database>
      1 <description>
      1 <digest>
      1 <div>
      1 <div class=\"Remarks\">
      1 <Document_name>
      1 <</dt>
      1 <=</dt>
      1 <EqualTo>
      1 <ExportJobName>
      1 <folder>
      1 <folder\n         name>
      1 <ForecastExportJobName>
      1 </GetMetricWidgetImageResponse>
      1 <GetMetricWidgetImageResponse xmlns=<URLstring>
      1 </GetMetricWidgetImageResult>
      1 <GetMetricWidgetImageResult>
      1 <group-name>
      1 <instance-id-1>
      1 <instance-id-2>
      1 </isTruncated>
      1 <isTruncated>
      1 <job-id>
      1 <link  linkend=\"apps-application-id-journeys-journey-id-state\">
      1 </literal>
      1 <literal>
      1 <managed rule group name>
      1 </MetricWidgetImage>
      1 <MetricWidgetImage>
      1 <N>
      1 <name of container>
      1 <name of\n         container>
      1 <(.|\\n)*ManifestConfirmConditionNotification(.|\\n)*>
      1 <node-group-id>
      1 </NotificationConfiguration>
      1 <NotificationConfiguration>
      1 <(.|\\n)*SignalProcessingNotification(.|\\n)*>
      1 <objectKey>
      1 <object-name>
      1 <OrAllFilters>
      1 <output-file.mp3>
      1 <!--   <p>
      1 <Parameter_name>
      1 <path>
      1 <path\n               to ping>
      1 <path-to-source-code>
      1 <payload-field>
      1 <prefix>
      1 <protocol>
      1 <RandomGUID>
      1 <region-ID>
      1 <relevant-aws-account-id>
      1 <repo-name>
      1 <repo-name[
      1 </RequestId>
      1 <RequestId>
      1 <resource_arn>
      1 </ResponseMetadata>
      1 <ResponseMetadata>
      1 <rule group name>
      1 <runid>
      1 < Schema>
      1 <service-name>
      1 <ServiceName>
      1 <simid>
      1 <someone@example.com>
      1 <Stage Name>
      1 <string>
      1 <table>
      1 <tag>
      1 <testuser@example.com>
      1 </u>
      1 <u>
      1 <user_arn>
      1 <vendor name>
      1 <!-- Why is this declared as the input to create an API key? As a form of copying an existing key value into a new API key? -->
      1 <window-target-id-1>
      1 <window-target-id-2>
      1 <=x<1.0.</p>
      1 <YOUR_USER_POOL_ID>
      2 <, >
     20 <a href=\"/kinesisanalytics/latest/apiv2/Welcome.html\">
     20 <outpost-id>
     20 </pre>
     20 <pre>
     22 <Region>
   2369 </note>
   2369 <note>
     25 <account-id>
     25 </strong>
     25 <strong>
     26 <div class=\"remarks\">
     26 </link>
      2 <Accessibility>
      2 <Accessibility schemeIdUri=\"urn
      2 <access-point-name>
      2 <acct-id>
      2 <a href=\"xxxxx\">
      2 <aws-region>
      2 <bucket_name>
      2 <Column, Type>
      2 <CRLF>
      2 <default>
      2 <div class=\"example\">
      2 <field-name>
      2 <). For example, you can use a size constraint statement to look for query strings that are longer than 100 bytes. </p>
      2 <imagelabel>
      2 <input-file>
      2 <instanceid1>
      2 <instanceid2>
      2 <keyprefix>
      2 <link  linkend=\"apps-application-id-events\">
      2 <link  linkend=\"apps-application-id-journeys-journey-id\">
      2 <major>
      2 <minor>
      2 <object>
      2 <objectkey>
      2 <PartNumber>
      2 <patch>
      2 <primary-node-id>
      2 <role-name>
      2 <rule name>
      2 <service-principal-name>
      2 <tag name>
      2 <tag value>
      2 <task-uuid>
      2 <Unicode>
      2 <version-id>
      2 <= x < 1.0.</p>
      3 <= | >
      3 < | >
     32 <a href=\"/general/latest/gr/aws-arns-and-namespaces.html\">
   3516 </b>
   3516 <b>
     39 <>
      3 <a href=\"\">
      3 <a href=\"/streams/latest/dev/building-enhanced-consumers-api.html\">
      3 <alias>
      3 <build-ID>
      3 <custom ID string or idempotency token>
      3 </DisplayName>
      3 <DisplayName>
      3 </EmailAddress>
      3 <EmailAddress>
      3 </end>
      3 <end>
      3 <fleet ID>
      3 <<i>
      3 </ID>
      3 <ID>
      3 <input-name>
      3 <link  linkend=\"apps-application-id-campaigns-campaign-id\">
      3 <name>
      3 <path-to-datum>
      3 <port>
      3 <region-name>
      3 <registry>
      3 <repository>
      3 <repository-name>
      3 </row>
      3 <row item_a=\"A\" item_b=\"B\">
      3 <row item_a=\"A\" item_b=\"B\" />
      3 </start>
      3 <start>
      3 <tunnel-id>
      3 </URI>
      3 <URI>
      3 <variable-name>
    413 </important>
    413 <important>
     43 <key>
   4817 </ul>
   4818 <ul>
     48 <p/>
      4 <a href=\"/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-lambda\">
      4 <a href=\"/singlesignon/latest/IdentityStoreAPIReference/welcome.html\">
      4 <a href=\"/singlesignon/latest/userguide/abac.html\">
      4 <bucket-name>
      4 <clustername>
      4 <</code>
      4 <=</code>
      4 <ExportTimestamp>
      4 <instance>
      4 <node-id>
      4 <servicename>
      4 <status>
      4 <targetName>
      4 <targetType>
     53 <div class=\"seeAlso\">
    565 </dt>
    567 </dd>
    567 <dd>
    567 <dt>
      5 </br>
      5 <br>
      5 <file name>
      5 <my-accesspoint-name>
      5 <region identifier>
      5 </scanrange>
      5 <scanrange>
   6025 <i>
   6028 </i>
  60847 </code>
  60854 <code>
      6 <a href=\" https
      6 <a target=\"_blank\" href=\"https
      6 <b/>
      6 <day>
      6 </filename>
      6 <filename>
      7 <=>
   7594 <a>
      7 <alias-name>
      7 </Grantee>
     83 </div>
    845 <a href=\"http
      8 <a href=\"mailto
      8 <load-balancer-id>
      8 <load-balancer-name>
      8 <target-group-id>
      8 <target-group-name>
     91 </replaceable>
     91 <replaceable>
   9434 <a href=\"https
     94 </fullname>
     94 <fullname>
      9 <folder name>
      9 <Grantee xmlns
``` (Ken Gilmer - Feb 23, 2021)
aajtodd commented 3 years ago

closed by #61