🐛 Fix some issues with the schema
Enums could not be yaml'd for the docs build. Also fixed some use of strings where enum values were meant.
This commit is contained in:
1 parent
54f6e7119a
commit
d0bcd544aa
23 files changed
+42
-52
No files matched your search
@@ -1,2 +1,9 @@
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from pydantic import BaseModel as PydanticBaseModel
|
||||
|
||||
|
||||
class BaseModel(PydanticBaseModel):
|
||||
class Config:
|
||||
use_enum_values = True
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import List, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
from .access_control import AccessControlConfig
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from typing import Dict
|
||||
|
||||
from pydantic import BaseModel
|
||||
from typing import Dict, Optional
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
@with_attrs_docs
|
||||
class ApiConfig(BaseModel):
|
||||
key: str = None
|
||||
key: Optional[str] = None
|
||||
"""Global API key, deprecated, use User API keys instead. Unset by default, will be generated on first run."""
|
||||
|
||||
apps: Dict[str, str] = {}
|
||||
|
||||
@@ -4,8 +4,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
from enum import Enum
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
@@ -141,7 +140,7 @@ class AppearanceConfig(BaseModel):
|
||||
name: str = ""
|
||||
"""Use this to give your OctoPrint instance a name. It will be displayed in the title bar (as "<Name> [OctoPrint]") and in the navigation bar (as "OctoPrint: <>")"""
|
||||
|
||||
color: ColorEnum = "default"
|
||||
color: ColorEnum = ColorEnum.default
|
||||
"""Use this to color the navigation bar."""
|
||||
|
||||
colorTransparent: bool = False
|
||||
|
||||
@@ -4,9 +4,9 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
from enum import Enum
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic_settings import with_attrs_docs
|
||||
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
from octoprint.schema import BaseModel
|
||||
|
||||
|
||||
class LayoutEnum(str, Enum):
|
||||
@@ -47,7 +47,7 @@ class ContainerConfig(BaseModel):
|
||||
name: Optional[str] = None
|
||||
"""A name to display above the container, basically a section header."""
|
||||
|
||||
layout: LayoutEnum = "vertical"
|
||||
layout: LayoutEnum = LayoutEnum.vertical
|
||||
"""The layout to use for laying out the contained children, either from top to bottom (`vertical`) or from left to right (`horizontal`)."""
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
@@ -38,7 +37,7 @@ class DevelCacheConfig(BaseModel):
|
||||
|
||||
@with_attrs_docs
|
||||
class DevelConfig(BaseModel):
|
||||
stylesheet: StylesheetEnum = "css"
|
||||
stylesheet: StylesheetEnum = StylesheetEnum.css
|
||||
"""Settings for stylesheet preference. OctoPrint will prefer to use the stylesheet type specified here. Usually (on a production install) that will be the compiled css (default). Developers may specify less here too."""
|
||||
|
||||
cache: DevelCacheConfig = DevelCacheConfig()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
from enum import Enum
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -3,15 +3,14 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from enum import Enum
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
class RunAtEnum(str, Enum):
|
||||
never: str = "never"
|
||||
idle: str = "idle"
|
||||
always: str = "always"
|
||||
never = "never"
|
||||
idle = "idle"
|
||||
always = "always"
|
||||
|
||||
|
||||
@with_attrs_docs
|
||||
@@ -28,7 +27,7 @@ class GcodeAnalysisConfig(BaseModel):
|
||||
throttle_lines: int = 100
|
||||
"""GCODE line batch size."""
|
||||
|
||||
runAt: RunAtEnum = "idle"
|
||||
runAt: RunAtEnum = RunAtEnum.idle
|
||||
"""Whether to run the analysis only when idle (not printing), regardless of printing state or never."""
|
||||
|
||||
bedZ: float = 0.0
|
||||
|
||||
@@ -3,8 +3,9 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import Dict, List
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import Field
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import Dict, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
from enum import Enum
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
CONST_15MIN = 15 * 60
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import Dict, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import Field
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ __copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from octoprint.schema import BaseModel
|
||||
from octoprint.vendor.with_attrs_docs import with_attrs_docs
|
||||
|
||||
|
||||
@@ -34,7 +33,7 @@ class TimelapseOptions(BaseModel):
|
||||
|
||||
@with_attrs_docs
|
||||
class TimelapseConfig(BaseModel):
|
||||
type: TimelapseTypeEnum = "off"
|
||||
type: TimelapseTypeEnum = TimelapseTypeEnum.off
|
||||
"""The timelapse type."""
|
||||
|
||||
fps: int = 25
|
||||
|
||||
Reference in new issue
Block a user