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

fix(pydantic): python unwrap properties #2111

Draft
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

memdal
Copy link

@memdal memdal commented Oct 23, 2024

Description

Gets the dict from data as this is a pydantic object.

Checklist

  • The code follows the project's coding standards and is properly linted (npm run lint).
  • Tests have been added or updated to cover the changes.
  • Documentation has been updated to reflect the changes.
  • All tests pass successfully locally.(npm run test).

Additional Notes

@memdal memdal changed the base branch from master to next October 23, 2024 13:35
Copy link

netlify bot commented Oct 23, 2024

Deploy Preview for modelina ready!

Name Link
🔨 Latest commit 2f8a06b
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/6718fba3676ad100088c0665
😎 Deploy Preview https://deploy-preview-2111--modelina.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

sonarcloud bot commented Oct 23, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
3.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@memdal memdal changed the title Fix python unwrap properties fix(pydantic): python unwrap properties Oct 23, 2024
@@ -101,7 +101,7 @@ def custom_serializer(self, handler):
@model_validator(mode='before')
@classmethod
def unwrap_${dictionaryModel?.propertyName}(cls, data):
json_properties = list(data.keys())
json_properties = list(data.model_dump().keys())

Choose a reason for hiding this comment

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

@@ -32,7 +32,7 @@ exports[`PYTHON_PYDANTIC_PRESET should render pydantic for class 1`] = `

known_json_properties = ['prop', 'additionalProperties']

Choose a reason for hiding this comment

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

This code will never called because keys() doesn't return elements inside additionalProperties, then len(unknown_object_properties) == 0 is always true

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.

2 participants