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 Decimal serialization #6854

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b2ec164
fix decimal representation
giancarloromeo Nov 27, 2024
ee97853
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Nov 27, 2024
4a344ef
services/webserver api version: 0.46.0 → 0.47.0
giancarloromeo Nov 28, 2024
508866b
Merge branch 'fix-decimal-serialization' of github.com:giancarloromeo…
giancarloromeo Nov 28, 2024
c70c59e
services/webserver api version: 0.47.0 → 0.48.0
giancarloromeo Nov 28, 2024
ebbb2c1
make openapi-spec
giancarloromeo Nov 28, 2024
83471a5
revert to 0.46
giancarloromeo Nov 28, 2024
91a8719
revert to 0.46.0
giancarloromeo Nov 28, 2024
2d11717
services/webserver api version: 0.46.0 → 0.47.0
giancarloromeo Nov 28, 2024
3b7b41f
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Nov 28, 2024
9672898
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Nov 28, 2024
8f3b40a
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Nov 29, 2024
14d4cda
run make openapi.json
giancarloromeo Dec 2, 2024
c2660a8
make fields optional in Pydantic v2
giancarloromeo Dec 3, 2024
b6036e2
update openapi.json
giancarloromeo Dec 3, 2024
fd67b4f
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Dec 3, 2024
095c39a
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Dec 3, 2024
7ee6a0c
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Dec 3, 2024
37f7c05
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Dec 4, 2024
b8ed53b
remove oas spec test
giancarloromeo Dec 4, 2024
e2d4696
Merge branch 'master' into fix-decimal-serialization
giancarloromeo Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from datetime import datetime
from decimal import Decimal
from typing import Annotated

from pydantic import BaseModel, ConfigDict, PlainSerializer
from pydantic import BaseModel, ConfigDict

from ..resource_tracker import (
HardwareInfo,
Expand All @@ -19,9 +18,7 @@ class PricingUnitGet(BaseModel):
pricing_unit_id: PricingUnitId
unit_name: str
unit_extra_info: UnitExtraInfo
current_cost_per_unit: Annotated[
Decimal, PlainSerializer(float, return_type=float, when_used="json")
]
current_cost_per_unit: Decimal
current_cost_per_unit_id: PricingUnitCostId
default: bool
specific_info: HardwareInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from datetime import datetime
from decimal import Decimal
from typing import Annotated

from pydantic import BaseModel, ConfigDict, Field, PlainSerializer
from pydantic import BaseModel, ConfigDict, Field

from ..projects import ProjectID
from ..projects_nodes_io import NodeID
Expand Down Expand Up @@ -50,9 +49,7 @@ class PricingUnitGet(OutputSchema):
pricing_unit_id: PricingUnitId
unit_name: str
unit_extra_info: UnitExtraInfo
current_cost_per_unit: Annotated[
Decimal, PlainSerializer(float, return_type=float, when_used="json")
]
current_cost_per_unit: Decimal
default: bool


Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
from datetime import datetime
from decimal import Decimal
from typing import Annotated, Literal, TypeAlias
from typing import Literal, TypeAlias

from pydantic import (
ConfigDict,
Field,
HttpUrl,
PlainSerializer,
ValidationInfo,
field_validator,
)
from pydantic import ConfigDict, Field, HttpUrl, ValidationInfo, field_validator

from ..basic_types import AmountDecimal, IDStr, NonNegativeDecimal
from ..users import GroupID
Expand All @@ -20,9 +13,9 @@
class WalletGet(OutputSchema):
wallet_id: WalletID
name: IDStr
description: str | None
description: str | None = None
owner: GroupID
thumbnail: str | None
thumbnail: str | None = None
status: WalletStatus
created: datetime
modified: datetime
Expand All @@ -31,7 +24,7 @@ class WalletGet(OutputSchema):


class WalletGetWithAvailableCredits(WalletGet):
available_credits: Annotated[Decimal, PlainSerializer(float)]
available_credits: Decimal


class WalletGetPermissions(WalletGet):
Expand Down
4 changes: 2 additions & 2 deletions services/api-server/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6492,7 +6492,7 @@
"$ref": "#/components/schemas/UnitExtraInfo"
},
"currentCostPerUnit": {
"type": "number",
"type": "string",
"title": "Currentcostperunit"
},
"default": {
Expand Down Expand Up @@ -7093,7 +7093,7 @@
"title": "Modified"
},
"availableCredits": {
"type": "number",
"type": "string",
"title": "Availablecredits"
}
},
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion services/web/server/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.46.0
0.47.0
2 changes: 1 addition & 1 deletion services/web/server/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.46.0
current_version = 0.47.0
commit = True
message = services/webserver api version: {current_version} → {new_version}
tag = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.1.0
info:
title: simcore-service-webserver
description: Main service with an interface (http-API & websockets) to the web front-end
version: 0.46.0
version: 0.47.0
servers:
- url: ''
description: webserver
Expand Down Expand Up @@ -11314,7 +11314,7 @@ components:
unitExtraInfo:
$ref: '#/components/schemas/UnitExtraInfo-Output'
currentCostPerUnit:
type: number
type: string
title: Currentcostperunit
default:
type: boolean
Expand Down Expand Up @@ -11358,7 +11358,7 @@ components:
unitExtraInfo:
$ref: '#/components/schemas/UnitExtraInfo-Output'
currentCostPerUnit:
type: number
type: string
title: Currentcostperunit
default:
type: boolean
Expand Down Expand Up @@ -14079,7 +14079,7 @@ components:
format: date-time
title: Modified
availableCredits:
type: number
type: string
title: Availablecredits
type: object
required:
Expand Down
Loading