-
Notifications
You must be signed in to change notification settings - Fork 12
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
chore: Bump pydantic to ^2.4.2 [TCTC-7241] #1272
Conversation
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sinon top 👍 Content du refacto pour le kwarg dans __init_subclass__
C'est encore plus clean
@@ -65,7 +65,7 @@ def test_get_form(mocker, connector, create_datasource): | |||
) | |||
form = create_datasource.get_form(connector, {}) | |||
assert form['properties']['parameters']['description'] == 'Services documentation: <br> coucou' | |||
assert form['definitions']['method']['enum'][0] == 'fake_func' | |||
assert form['$defs']['method']['const'] == 'fake_func' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'aurais proposé de changer DEFAULT_REF_TEMPLATE
pour changer le moins de tests possibles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je viens de tester avec ref_template='#/definitions/{model}'
, et les definitions restent malgré tout dans la clé $defs
. Seule leur référence change. Exemple:
from enum import StrEnum
import json
from pydantic import BaseModel
class E(StrEnum):
one = "one"
two = "two"
class A(BaseModel):
e: E
print(json.dumps(A.model_json_schema(), indent=2))
print(json.dumps(A.model_json_schema(ref_template="#/definitions/{model}"), indent=2))
Donne
{
"$defs": {
"E": {
"enum": [
"one",
"two"
],
"title": "E",
"type": "string"
}
},
"properties": {
"e": {
"$ref": "#/$defs/E"
}
},
"required": [
"e"
],
"title": "A",
"type": "object"
}
{
"$defs": {
"E": {
"enum": [
"one",
"two"
],
"title": "E",
"type": "string"
}
},
"properties": {
"e": {
"$ref": "#/definitions/E"
}
},
"required": [
"e"
],
"title": "A",
"type": "object"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je viens de tester avec ref_template='#/definitions/{model}'
, et les definitions restent malgré tout dans la clé $defs
. Seule leur référence change. Exemple:
from enum import StrEnum
import json
from pydantic import BaseModel
class E(StrEnum):
one = "one"
two = "two"
class A(BaseModel):
e: E
print(json.dumps(A.model_json_schema(), indent=2))
print(json.dumps(A.model_json_schema(ref_template="#/definitions/{model}"), indent=2))
Donne
{
"$defs": {
"E": {
"enum": [
"one",
"two"
],
"title": "E",
"type": "string"
}
},
"properties": {
"e": {
"$ref": "#/$defs/E"
}
},
"required": [
"e"
],
"title": "A",
"type": "object"
}
{
"$defs": {
"E": {
"enum": [
"one",
"two"
],
"title": "E",
"type": "string"
}
},
"properties": {
"e": {
"$ref": "#/definitions/E"
}
},
"required": [
"e"
],
"title": "A",
"type": "object"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je viens de tester avec ref_template='#/definitions/{model}'
, et les definitions restent malgré tout dans la clé $defs
. Seule leur référence change. Exemple:
from enum import StrEnum
import json
from pydantic import BaseModel
class E(StrEnum):
one = "one"
two = "two"
class A(BaseModel):
e: E
print(json.dumps(A.model_json_schema(), indent=2))
print(json.dumps(A.model_json_schema(ref_template="#/definitions/{model}"), indent=2))
Donne
{
"$defs": {
"E": {
"enum": [
"one",
"two"
],
"title": "E",
"type": "string"
}
},
"properties": {
"e": {
"$ref": "#/$defs/E"
}
},
"required": [
"e"
],
"title": "A",
"type": "object"
}
{
"$defs": {
"E": {
"enum": [
"one",
"two"
],
"title": "E",
"type": "string"
}
},
"properties": {
"e": {
"$ref": "#/definitions/E"
}
},
"required": [
"e"
],
"title": "A",
"type": "object"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est pas un bug ? 🤔
A priori non
README.md
Outdated
@@ -155,10 +155,8 @@ class MyTypeDataSource(ToucanDataSource): | |||
query: str | |||
|
|||
|
|||
class MyTypeConnector(ToucanConnector): | |||
class MyTypeConnector(ToucanConnector,data_source_model=MyTypeDataSource): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class MyTypeConnector(ToucanConnector,data_source_model=MyTypeDataSource): | |
class MyTypeConnector(ToucanConnector, data_source_model=MyTypeDataSource): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyproject.toml
Outdated
@@ -23,7 +23,7 @@ Authlib = "^1.0.1" | |||
cached-property = "^1.5.2" | |||
Jinja2 = "^3.0.3" | |||
jq = "^1.2.2" | |||
pydantic = "^1.9.1" | |||
pydantic = "^2.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ptet qu'on peut deja mettre la 2.4.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class GoogleBigQueryConnector(ToucanConnector, DiscoverableConnector): | ||
class GoogleBigQueryConnector( | ||
ToucanConnector, DiscoverableConnector, data_source_model=GoogleBigQueryDataSource | ||
): | ||
data_source_model: GoogleBigQueryDataSource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a virer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Eric Jolibois <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
bd1af36
to
2d6f547
Compare
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
Signed-off-by: Luka Peschke <[email protected]>
No description provided.