announcement_service_spec.yaml updated, patchnotes_controller.py updated accordingly to changes

This commit is contained in:
2025-05-21 12:55:42 +02:00
parent 5007a434ca
commit 87651e70d4
9 changed files with 586 additions and 329 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# flake8: noqa
# import models into model package
from openapi_server.models.patch_notes import PatchNotes
from openapi_server.models.user import User
from openapi_server.models.patch_notes_input import PatchNotesInput
+5 -9
View File
@@ -1,7 +1,6 @@
import pprint
import typing
from datetime import datetime
from openapi_server import util
@@ -29,26 +28,23 @@ class Model:
"""
result = {}
for attr, _ in self.openapi_types.items():
for attr in self.openapi_types:
value = getattr(self, attr)
dict_attr = self.attribute_map[attr]
if isinstance(value, list):
result[dict_attr] = list(map(
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[dict_attr] = value.to_dict()
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[dict_attr] = dict(map(
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
elif isinstance(value, datetime):
result[dict_attr] = value.isoformat()
else:
result[dict_attr] = value
result[attr] = value
return result
+8 -6
View File
@@ -24,14 +24,14 @@ class PatchNotes(Model):
:param version: The version of this PatchNotes. # noqa: E501
:type version: str
:param patch_date: The patch_date of this PatchNotes. # noqa: E501
:type patch_date: str
:type patch_date: date
"""
self.openapi_types = {
'patch_id': str,
'title': str,
'changes': str,
'version': str,
'patch_date': str
'patch_date': date
}
self.attribute_map = {
@@ -77,6 +77,8 @@ class PatchNotes(Model):
:param patch_id: The patch_id of this PatchNotes.
:type patch_id: str
"""
if patch_id is None:
raise ValueError("Invalid value for `patch_id`, must not be `None`") # noqa: E501
self._patch_id = patch_id
@@ -150,22 +152,22 @@ class PatchNotes(Model):
self._version = version
@property
def patch_date(self) -> str:
def patch_date(self) -> date:
"""Gets the patch_date of this PatchNotes.
:return: The patch_date of this PatchNotes.
:rtype: str
:rtype: date
"""
return self._patch_date
@patch_date.setter
def patch_date(self, patch_date: str):
def patch_date(self, patch_date: date):
"""Sets the patch_date of this PatchNotes.
:param patch_date: The patch_date of this PatchNotes.
:type patch_date: str
:type patch_date: date
"""
if patch_date is None:
raise ValueError("Invalid value for `patch_date`, must not be `None`") # noqa: E501
@@ -0,0 +1,147 @@
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model import Model
from openapi_server import util
class PatchNotesInput(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Do not edit the class manually.
"""
def __init__(self, title=None, changes=None, version=None, patch_date=None): # noqa: E501
"""PatchNotesInput - a model defined in OpenAPI
:param title: The title of this PatchNotesInput. # noqa: E501
:type title: str
:param changes: The changes of this PatchNotesInput. # noqa: E501
:type changes: str
:param version: The version of this PatchNotesInput. # noqa: E501
:type version: str
:param patch_date: The patch_date of this PatchNotesInput. # noqa: E501
:type patch_date: date
"""
self.openapi_types = {
'title': str,
'changes': str,
'version': str,
'patch_date': date
}
self.attribute_map = {
'title': 'title',
'changes': 'changes',
'version': 'version',
'patch_date': 'patch_date'
}
self._title = title
self._changes = changes
self._version = version
self._patch_date = patch_date
@classmethod
def from_dict(cls, dikt) -> 'PatchNotesInput':
"""Returns the dict as a model
:param dikt: A dict.
:type: dict
:return: The patch_notes_input of this PatchNotesInput. # noqa: E501
:rtype: PatchNotesInput
"""
return util.deserialize_model(dikt, cls)
@property
def title(self) -> str:
"""Gets the title of this PatchNotesInput.
:return: The title of this PatchNotesInput.
:rtype: str
"""
return self._title
@title.setter
def title(self, title: str):
"""Sets the title of this PatchNotesInput.
:param title: The title of this PatchNotesInput.
:type title: str
"""
if title is None:
raise ValueError("Invalid value for `title`, must not be `None`") # noqa: E501
self._title = title
@property
def changes(self) -> str:
"""Gets the changes of this PatchNotesInput.
:return: The changes of this PatchNotesInput.
:rtype: str
"""
return self._changes
@changes.setter
def changes(self, changes: str):
"""Sets the changes of this PatchNotesInput.
:param changes: The changes of this PatchNotesInput.
:type changes: str
"""
if changes is None:
raise ValueError("Invalid value for `changes`, must not be `None`") # noqa: E501
self._changes = changes
@property
def version(self) -> str:
"""Gets the version of this PatchNotesInput.
:return: The version of this PatchNotesInput.
:rtype: str
"""
return self._version
@version.setter
def version(self, version: str):
"""Sets the version of this PatchNotesInput.
:param version: The version of this PatchNotesInput.
:type version: str
"""
if version is None:
raise ValueError("Invalid value for `version`, must not be `None`") # noqa: E501
self._version = version
@property
def patch_date(self) -> date:
"""Gets the patch_date of this PatchNotesInput.
:return: The patch_date of this PatchNotesInput.
:rtype: date
"""
return self._patch_date
@patch_date.setter
def patch_date(self, patch_date: date):
"""Sets the patch_date of this PatchNotesInput.
:param patch_date: The patch_date of this PatchNotesInput.
:type patch_date: date
"""
if patch_date is None:
raise ValueError("Invalid value for `patch_date`, must not be `None`") # noqa: E501
self._patch_date = patch_date