File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 "generatorName" : " python" ,
66 "inputSpec" : " public_accessa/api/v2/docs/cb-v2-openapi-3.0.0.yaml" ,
77 "outputDir" : " ." ,
8+ "templateDir" : " templates" ,
89 "additionalProperties" : {
910 "packageName" : " cloudbeds_pms" ,
1011 "projectName" : " Cloudbeds PMS" ,
1112 "packageVersion" : " 2.9.0" ,
1213 "packageDescription" : " OpenAPI client for Cloudbeds PMS API." ,
1314 "generateSourceCodeOnly" : true ,
14- "packageUrl" : " https://github.com/cloudbeds/cloudbeds-api-python"
15+ "packageUrl" : " https://github.com/cloudbeds/cloudbeds-api-python" ,
16+ "enumUnknownDefaultCase" : true
1517 },
1618 "files" : {
1719 "README_onlypackage.mustache" : {
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+ import json
3+ from enum import Enum
4+ { {#vendorExtensions.x-py-other-imports} }
5+ { {{.} }}
6+ { {/vendorExtensions.x-py-other-imports} }
7+ from typing_extensions import Self
8+
9+
10+ class { {classname} }({ {vendorExtensions.x-py-enum-type} }, Enum):
11+ """
12+ { {{description} }}{ {^description} }{ {{classname} }}{ {/description} }
13+ """
14+
15+ """
16+ allowed enum values
17+ """
18+ { {#allowableValues} }
19+ { {#enumVars} }
20+ { {{name} }} = { {{value} }}
21+ { {/enumVars} }
22+
23+ @classmethod
24+ def from_json(cls, json_str: str) -> Self:
25+ """Create an instance of { {classname} } from a JSON string"""
26+ return cls(json.loads(json_str))
27+
28+ { {#enumUnknownDefaultCase} }
29+ @classmethod
30+ def _missing_(cls, value):
31+ """Handle unknown enum values by returning the unknown default case."""
32+ return cls.UNKNOWN_DEFAULT_OPEN_API
33+ { {/enumUnknownDefaultCase} }
34+ { {/allowableValues} }
You can’t perform that action at this time.
0 commit comments