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

Improve annotated default detection #856

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

koxudaxi
Copy link
Owner

@koxudaxi koxudaxi commented Jan 3, 2024

Fixes: #731

@koxudaxi koxudaxi force-pushed the Improve_annotated_default_detection branch from 243cd5c to 54648da Compare January 3, 2024 17:27
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (b2597b5) 72.19% compared to head (d50a5b1) 72.19%.

Files Patch % Lines
src/com/koxudaxi/pydantic/Pydantic.kt 57.14% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #856   +/-   ##
=======================================
  Coverage   72.19%   72.19%           
=======================================
  Files          27       27           
  Lines        2093     2093           
  Branches      643      643           
=======================================
  Hits         1511     1511           
  Misses        276      276           
  Partials      306      306           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Jan 3, 2024

Qodana Community for Python

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

  1. Register at Qodana Cloud and configure the action
  2. Use GitHub Code Scanning with Qodana
  3. Host Qodana report at GitHub Pages
  4. Inspect and use qodana.sarif.json (see the Qodana SARIF format for details)

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2023.3.0
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@koxudaxi koxudaxi force-pushed the Improve_annotated_default_detection branch from dd48915 to 39186ce Compare January 3, 2024 17:46
@koxudaxi koxudaxi force-pushed the Improve_annotated_default_detection branch from 39186ce to af3a462 Compare January 3, 2024 17:53
@koxudaxi koxudaxi merged commit 52832b3 into main Jan 3, 2024
4 of 5 checks passed
@koxudaxi koxudaxi deleted the Improve_annotated_default_detection branch January 3, 2024 18:06
Comment on lines +12 to +13
klm: Annotated[str, Info(), Field(default_factory=lambda: 456)]
nop: Annotated[str, Field(default_factory=lambda: 789), Info()]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@koxudaxi just a quick question, i see that this is tested only with default_factory. is there a reason for not also having a test case with default? (that's the flavor of error I had run into with this)

thanks regardless! :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tshimanga
I expect only default_factory. because, pydantic v1 don't allow default in the annotated Field.
But, Pydantic V2 doesn't say any error. I will fix it in another PR.
image

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

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.

Does not look into typing.Annotated to find default
2 participants