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): use default values according to defaultsMode config #3192

Merged
merged 1 commit into from
Jan 14, 2022

Conversation

AllanZhengYP
Copy link
Contributor

Description

What does this implement/fix? Explain your changes.

Testing

How was this change tested?

Additional context

Add any other context about the PR here.


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

@AllanZhengYP AllanZhengYP requested a review from a team as a code owner January 14, 2022 21:47
@trivikr
Copy link
Member

trivikr commented Jan 14, 2022

The server protocol tests are failing, because exclude config is not added.

Error:

error TS6059: File '/home/runner/work/aws-sdk-js-v3/aws-sdk-js-v3/private/aws-restjson-validation-server/test/functional/restjson1.spec.ts' is not under 'rootDir' '/home/runner/work/aws-sdk-js-v3/aws-sdk-js-v3/private/aws-restjson-validation-server/src'. 'rootDir' is expected to contain all source files.

Earlier it was added in tsconfig.json, but we removed it because non-test clients do not emit tests.
We'll re-add it as of now to ensure server protocol tests pass.

@trivikr
Copy link
Member

trivikr commented Jan 14, 2022

Earlier it was added in tsconfig.json, but we removed it because non-test clients do not emit tests.
We'll re-add it as of now to ensure server protocol tests pass.

Exclude folder added in smithy-lang/smithy-typescript#496

@AllanZhengYP
Copy link
Contributor Author

Codegen-ci can be signed off since it only complains Java style issues, I will fix it in followup PR:

<BugInstance type="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE" priority="2" rank="16" abbrev="RV" category="BAD_PRACTICE" instanceHash="d6dcc21b80bd1963df0f310c65a7816b" instanceOccurrenceNum="0" instanceOccurrenceMax="0" cweid="253">
    <ShortMessage>Method ignores exceptional return value</ShortMessage>
    <LongMessage>Exceptional return value of java.io.File.createNewFile() ignored in software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator.main(String[])</LongMessage>
    <Class classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" primary="true">
      <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" start="61" end="107" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java">
        <Message>At DefaultsModeConfigGenerator.java:[lines 61-107]</Message>
      </SourceLine>
      <Message>In class software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator</Message>
    </Class>
    <Method classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" name="main" signature="([Ljava/lang/String;)V" isStatic="true" primary="true">
      <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" start="64" end="107" startBytecode="0" endBytecode="702" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java"/>
      <Message>In method software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator.main(String[])</Message>
    </Method>
    <Method classname="java.io.File" name="createNewFile" signature="()Z" isStatic="false" role="METHOD_CALLED">
      <SourceLine classname="java.io.File" start="1030" end="1035" startBytecode="0" endBytecode="126" sourcefile="File.java" sourcepath="java/io/File.java"/>
      <Message>Called method java.io.File.createNewFile()</Message>
    </Method>
    <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" primary="true" start="105" end="105" startBytecode="330" endBytecode="330" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java">
      <Message>At DefaultsModeConfigGenerator.java:[line 105]</Message>
    </SourceLine>
  </BugInstance>
  <BugInstance type="SBSC_USE_STRINGBUFFER_CONCATENATION" priority="2" rank="18" abbrev="SBSC" category="PERFORMANCE" instanceHash="600649c208865b03b6881c487245470d" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
    <ShortMessage>Method concatenates strings using + in a loop</ShortMessage>
    <LongMessage>software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator.main(String[]) concatenates strings using + in a loop</LongMessage>
    <Class classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" primary="true">
      <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" start="61" end="107" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java">
        <Message>At DefaultsModeConfigGenerator.java:[lines 61-107]</Message>
      </SourceLine>
      <Message>In class software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator</Message>
    </Class>
    <Method classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" name="main" signature="([Ljava/lang/String;)V" isStatic="true" primary="true">
      <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" start="64" end="107" startBytecode="0" endBytecode="702" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java"/>
      <Message>In method software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator.main(String[])</Message>
    </Method>
    <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" primary="true" start="96" end="96" startBytecode="195" endBytecode="195" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java">
      <Message>At DefaultsModeConfigGenerator.java:[line 96]</Message>
    </SourceLine>
  </BugInstance>
  <BugInstance type="VA_FORMAT_STRING_USES_NEWLINE" priority="2" rank="20" abbrev="FS" category="BAD_PRACTICE" instanceHash="10ed42fac12d27a9e1ebaec5ee0aa0c4" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
    <ShortMessage>Format string should use %n rather than \n</ShortMessage>
    <LongMessage>Format string should use %n rather than \n in software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator.main(String[])</LongMessage>
    <Class classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" primary="true">
      <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" start="61" end="107" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java">
        <Message>At DefaultsModeConfigGenerator.java:[lines 61-107]</Message>
      </SourceLine>
      <Message>In class software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator</Message>
    </Class>
    <Method classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" name="main" signature="([Ljava/lang/String;)V" isStatic="true" primary="true">
      <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" start="64" end="107" startBytecode="0" endBytecode="702" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java"/>
      <Message>In method software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator.main(String[])</Message>
    </Method>
    <Method classname="java.lang.String" name="format" signature="(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;" isStatic="true" role="METHOD_CALLED">
      <SourceLine classname="java.lang.String" start="2897" end="2897" startBytecode="0" endBytecode="67" sourcefile="String.java" sourcepath="java/lang/String.java"/>
      <Message>Called method String.format(String, Object[])</Message>
    </Method>
    <String value="* `&quot;%s&quot;`: %s\n" role="STRING_FORMAT_STRING">
      <Message>Format string &quot;* `&quot;%s&quot;`: %s\n&quot;</Message>
    </String>
    <SourceLine classname="software.amazon.smithy.aws.typescript.codegen.DefaultsModeConfigGenerator" primary="true" start="96" end="96" startBytecode="223" endBytecode="223" sourcefile="DefaultsModeConfigGenerator.java" sourcepath="software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java" relSourcepath="src/main/java/software/amazon/smithy/aws/typescript/codegen/DefaultsModeConfigGenerator.java">
      <Message>At DefaultsModeConfigGenerator.java:[line 96]</Message>
    </SourceLine>
  </BugInstance>

@AllanZhengYP AllanZhengYP merged commit 9152e21 into aws:main Jan 14, 2022
@github-actions
Copy link

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 Jan 29, 2022
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