update the __init__.py
Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -26,12 +26,23 @@ def generateTypes(cwd: str, parser: OpenApiParser):
|
||||
path = os.path.join(cwd, 'kittycad', 'models')
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
# Open the __init__.py file.
|
||||
file_name = '__init__.py'
|
||||
file_path = os.path.join(path, file_name)
|
||||
f = open(file_path, 'w')
|
||||
f.write("\"\"\" Contains all the data models used in inputs/outputs \"\"\"\n")
|
||||
f.write("\n")
|
||||
|
||||
# Generate the types.
|
||||
data = parser.data
|
||||
schemas = data['components']['schemas']
|
||||
for key in schemas:
|
||||
schema = schemas[key]
|
||||
generateType(path, key, schema)
|
||||
f.write("from ."+camel_to_snake(key)+" import " + key + "\n")
|
||||
|
||||
# Close the file.
|
||||
f.close()
|
||||
|
||||
def generateType(path: str, name: str, schema: dict):
|
||||
# Generate the type.
|
||||
@ -250,6 +261,9 @@ def generateType(path: str, name: str, schema: dict):
|
||||
print(" unsupported type: ", type_name)
|
||||
return
|
||||
|
||||
# Close the file.
|
||||
f.close()
|
||||
|
||||
def hasDateTime(schema: dict) -> bool:
|
||||
# Generate the type.
|
||||
if 'type' in schema:
|
||||
|
@ -1,10 +1,13 @@
|
||||
""" Contains all the data models used in inputs/outputs """
|
||||
|
||||
from .auth_session import AuthSession
|
||||
from .environment import Environment
|
||||
from .error_message import ErrorMessage
|
||||
from .file_conversion import FileConversion
|
||||
from .file_conversion_status import FileConversionStatus
|
||||
from .instance_metadata import InstanceMetadata
|
||||
from .message import Message
|
||||
from .valid_file_type import ValidFileType
|
||||
from .gpu_device import GPUDevice
|
||||
from .instance import Instance
|
||||
from .pong_enum import PongEnum
|
||||
from .pong_message import PongMessage
|
||||
from .server_env import ServerEnv
|
||||
from .valid_output_file_format import ValidOutputFileFormat
|
||||
from .valid_source_file_format import ValidSourceFileFormat
|
||||
|
Reference in New Issue
Block a user