Skip to content

Commit

Permalink
remove proposed common models for version release safety
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorcary committed Jul 3, 2024
1 parent dcf73ad commit cdd791f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
10 changes: 1 addition & 9 deletions src/middlewared/middlewared/api/v25_04_0/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from middlewared.api.base import BaseModel

__all__ = ["QueryOptions", "QueryArgs", "NoArgs", "NoneReturn"]
__all__ = ["QueryOptions", "QueryArgs"]


class QueryOptions(BaseModel):
Expand All @@ -23,11 +23,3 @@ class QueryOptions(BaseModel):
class QueryArgs(BaseModel):
filters: list[Any] = [] # FIXME: Add validation here
options: QueryOptions = QueryOptions()


class NoArgs(BaseModel):
pass


class NoneReturn(BaseModel):
result: None
12 changes: 12 additions & 0 deletions src/middlewared/middlewared/api/v25_04_0/vendor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
from middlewared.api.base import BaseModel


class VendorNameArgs(BaseModel):
pass


class VendorNameResult(BaseModel):
result: str | None


class UnvendorArgs(BaseModel):
pass


class UnvendorResult(BaseModel):
result: None
6 changes: 3 additions & 3 deletions src/middlewared/middlewared/plugins/system/vendor/vendor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from middlewared.api import api_method
from middlewared.api.current import NoArgs, NoneReturn, VendorNameResult
from middlewared.api.current import VendorNameArgs, VendorNameResult, UnvendorArgs, UnvendorResult
from middlewared.service import Service


Expand All @@ -10,7 +10,7 @@

class VendorService(Service):

@api_method(NoArgs, VendorNameResult, private=True)
@api_method(VendorNameArgs, VendorNameResult, private=True)
def name(self) -> str | None:
try:
with open(SENTINEL_FILE_PATH, 'r') as file:
Expand All @@ -19,7 +19,7 @@ def name(self) -> str | None:
except FileNotFoundError:
return None

@api_method(NoArgs, NoneReturn, private=True)
@api_method(UnvendorArgs, UnvendorResult, private=True)
def unvendor(self):
try:
os.remove(SENTINEL_FILE_PATH)
Expand Down

0 comments on commit cdd791f

Please sign in to comment.