|
| 1 | +# generated by datamodel-codegen: |
| 2 | +# filename: https://raw.githubusercontent.com/polywrap/wrap/master/manifest/wrap.info/0.1.json |
| 3 | +# timestamp: 2022-10-22T13:35:25+00:00 |
| 4 | + |
| 5 | +from __future__ import annotations |
| 6 | + |
| 7 | +from enum import Enum |
| 8 | +from typing import List, Optional |
| 9 | + |
| 10 | +from pydantic import BaseModel, Extra, Field |
| 11 | + |
| 12 | + |
| 13 | +class Version(Enum): |
| 14 | + """ |
| 15 | + WRAP Standard Version |
| 16 | + """ |
| 17 | + |
| 18 | + VERSION_0_1_0 = '0.1.0' |
| 19 | + VERSION_0_1 = '0.1' |
| 20 | + |
| 21 | + |
| 22 | +class Type(Enum): |
| 23 | + """ |
| 24 | + Wrapper Package Type |
| 25 | + """ |
| 26 | + |
| 27 | + WASM = 'wasm' |
| 28 | + INTERFACE = 'interface' |
| 29 | + PLUGIN = 'plugin' |
| 30 | + |
| 31 | + |
| 32 | +class Env(BaseModel): |
| 33 | + required: Optional[bool] = None |
| 34 | + |
| 35 | + |
| 36 | +class GetImplementations(BaseModel): |
| 37 | + enabled: bool |
| 38 | + |
| 39 | + |
| 40 | +class CapabilityDefinition(BaseModel): |
| 41 | + get_implementations: Optional[GetImplementations] = Field( |
| 42 | + None, alias='getImplementations' |
| 43 | + ) |
| 44 | + |
| 45 | + |
| 46 | +class ImportedDefinition(BaseModel): |
| 47 | + uri: str |
| 48 | + namespace: str |
| 49 | + native_type: str = Field(..., alias='nativeType') |
| 50 | + |
| 51 | + |
| 52 | +class WithKind(BaseModel): |
| 53 | + kind: float |
| 54 | + |
| 55 | + |
| 56 | +class WithComment(BaseModel): |
| 57 | + comment: Optional[str] = None |
| 58 | + |
| 59 | + |
| 60 | +class GenericDefinition(WithKind): |
| 61 | + type: str |
| 62 | + name: Optional[str] = None |
| 63 | + required: Optional[bool] = None |
| 64 | + |
| 65 | + |
| 66 | +class ScalarType(Enum): |
| 67 | + U_INT = 'UInt' |
| 68 | + U_INT8 = 'UInt8' |
| 69 | + U_INT16 = 'UInt16' |
| 70 | + U_INT32 = 'UInt32' |
| 71 | + INT = 'Int' |
| 72 | + INT8 = 'Int8' |
| 73 | + INT16 = 'Int16' |
| 74 | + INT32 = 'Int32' |
| 75 | + STRING = 'String' |
| 76 | + BOOLEAN = 'Boolean' |
| 77 | + BYTES = 'Bytes' |
| 78 | + BIG_INT = 'BigInt' |
| 79 | + BIG_NUMBER = 'BigNumber' |
| 80 | + JSON = 'JSON' |
| 81 | + |
| 82 | + |
| 83 | +class ScalarDefinition(GenericDefinition): |
| 84 | + type: ScalarType |
| 85 | + |
| 86 | + |
| 87 | +class MapKeyType(Enum): |
| 88 | + U_INT = 'UInt' |
| 89 | + U_INT8 = 'UInt8' |
| 90 | + U_INT16 = 'UInt16' |
| 91 | + U_INT32 = 'UInt32' |
| 92 | + INT = 'Int' |
| 93 | + INT8 = 'Int8' |
| 94 | + INT16 = 'Int16' |
| 95 | + INT32 = 'Int32' |
| 96 | + STRING = 'String' |
| 97 | + |
| 98 | + |
| 99 | +class ObjectRef(GenericDefinition): |
| 100 | + pass |
| 101 | + |
| 102 | + |
| 103 | +class EnumRef(GenericDefinition): |
| 104 | + pass |
| 105 | + |
| 106 | + |
| 107 | +class UnresolvedObjectOrEnumRef(GenericDefinition): |
| 108 | + pass |
| 109 | + |
| 110 | + |
| 111 | +class ImportedModuleRef(BaseModel): |
| 112 | + type: Optional[str] = None |
| 113 | + |
| 114 | + |
| 115 | +class InterfaceImplementedDefinition(GenericDefinition): |
| 116 | + pass |
| 117 | + |
| 118 | + |
| 119 | +class EnumDefinition(GenericDefinition, WithComment): |
| 120 | + constants: Optional[List[str]] = None |
| 121 | + |
| 122 | + |
| 123 | +class InterfaceDefinition(GenericDefinition, ImportedDefinition): |
| 124 | + capabilities: Optional[CapabilityDefinition] = None |
| 125 | + |
| 126 | + |
| 127 | +class ImportedEnumDefinition(EnumDefinition, ImportedDefinition): |
| 128 | + pass |
| 129 | + |
| 130 | + |
| 131 | +class WrapManifest(BaseModel): |
| 132 | + class Config: |
| 133 | + extra = Extra.forbid |
| 134 | + |
| 135 | + version: Version = Field(..., description='WRAP Standard Version') |
| 136 | + type: Type = Field(..., description='Wrapper Package Type') |
| 137 | + name: str = Field(..., description='Wrapper Name', regex='^[a-zA-Z0-9\\-\\_]+$') |
| 138 | + abi: Abi = Field(..., description='Information of modules') |
| 139 | + |
| 140 | + |
| 141 | +class Abi(BaseModel): |
| 142 | + version: Optional[str] = Field(None, description='ABI Version') |
| 143 | + object_types: Optional[List[ObjectDefinition]] = Field(None, alias='objectTypes') |
| 144 | + module_type: Optional[ModuleDefinition] = Field(None, alias='moduleType') |
| 145 | + enum_types: Optional[List[EnumDefinition]] = Field(None, alias='enumTypes') |
| 146 | + interface_types: Optional[List[InterfaceDefinition]] = Field( |
| 147 | + None, alias='interfaceTypes' |
| 148 | + ) |
| 149 | + imported_object_types: Optional[List[ImportedObjectDefinition]] = Field( |
| 150 | + None, alias='importedObjectTypes' |
| 151 | + ) |
| 152 | + imported_module_types: Optional[List[ImportedModuleDefinition]] = Field( |
| 153 | + None, alias='importedModuleTypes' |
| 154 | + ) |
| 155 | + imported_enum_types: Optional[List[ImportedEnumDefinition]] = Field( |
| 156 | + None, alias='importedEnumTypes' |
| 157 | + ) |
| 158 | + imported_env_types: Optional[List[ImportedEnvDefinition]] = Field( |
| 159 | + None, alias='importedEnvTypes' |
| 160 | + ) |
| 161 | + env_type: Optional[EnvDefinition] = Field(None, alias='envType') |
| 162 | + |
| 163 | + |
| 164 | +class ObjectDefinition(GenericDefinition, WithComment): |
| 165 | + properties: Optional[List[PropertyDefinition]] = None |
| 166 | + interfaces: Optional[List[InterfaceImplementedDefinition]] = None |
| 167 | + |
| 168 | + |
| 169 | +class ModuleDefinition(GenericDefinition, WithComment): |
| 170 | + methods: Optional[List[MethodDefinition]] = None |
| 171 | + imports: Optional[List[ImportedModuleRef]] = None |
| 172 | + interfaces: Optional[List[InterfaceImplementedDefinition]] = None |
| 173 | + |
| 174 | + |
| 175 | +class MethodDefinition(GenericDefinition, WithComment): |
| 176 | + arguments: Optional[List[PropertyDefinition]] = None |
| 177 | + env: Optional[Env] = None |
| 178 | + return_: Optional[PropertyDefinition] = Field(None, alias='return') |
| 179 | + |
| 180 | + |
| 181 | +class ImportedModuleDefinition(GenericDefinition, ImportedDefinition, WithComment): |
| 182 | + methods: Optional[List[MethodDefinition]] = None |
| 183 | + is_interface: Optional[bool] = Field(None, alias='isInterface') |
| 184 | + |
| 185 | + |
| 186 | +class AnyDefinition(GenericDefinition): |
| 187 | + array: Optional[ArrayDefinition] = None |
| 188 | + scalar: Optional[ScalarDefinition] = None |
| 189 | + map: Optional[MapDefinition] = None |
| 190 | + object: Optional[ObjectRef] = None |
| 191 | + enum: Optional[EnumRef] = None |
| 192 | + unresolved_object_or_enum: Optional[UnresolvedObjectOrEnumRef] = Field( |
| 193 | + None, alias='unresolvedObjectOrEnum' |
| 194 | + ) |
| 195 | + |
| 196 | + |
| 197 | +class EnvDefinition(ObjectDefinition): |
| 198 | + pass |
| 199 | + |
| 200 | + |
| 201 | +class ImportedObjectDefinition(ObjectDefinition, ImportedDefinition, WithComment): |
| 202 | + pass |
| 203 | + |
| 204 | + |
| 205 | +class PropertyDefinition(WithComment, AnyDefinition): |
| 206 | + pass |
| 207 | + |
| 208 | + |
| 209 | +class ArrayDefinition(AnyDefinition): |
| 210 | + item: Optional[GenericDefinition] = None |
| 211 | + |
| 212 | + |
| 213 | +class MapKeyDefinition(AnyDefinition): |
| 214 | + type: Optional[MapKeyType] = None |
| 215 | + |
| 216 | + |
| 217 | +class MapDefinition(AnyDefinition, WithComment): |
| 218 | + key: Optional[MapKeyDefinition] = None |
| 219 | + value: Optional[GenericDefinition] = None |
| 220 | + |
| 221 | + |
| 222 | +class ImportedEnvDefinition(ImportedObjectDefinition): |
| 223 | + pass |
| 224 | + |
| 225 | + |
| 226 | +WrapManifest.update_forward_refs() |
| 227 | +Abi.update_forward_refs() |
| 228 | +ObjectDefinition.update_forward_refs() |
| 229 | +ModuleDefinition.update_forward_refs() |
| 230 | +MethodDefinition.update_forward_refs() |
| 231 | +AnyDefinition.update_forward_refs() |
| 232 | +EnvDefinition.update_forward_refs() |
| 233 | +ImportedObjectDefinition.update_forward_refs() |
| 234 | +PropertyDefinition.update_forward_refs() |
| 235 | +ArrayDefinition.update_forward_refs() |
| 236 | +MapKeyDefinition.update_forward_refs() |
| 237 | +MapDefinition.update_forward_refs() |
| 238 | +ImportedEnvDefinition.update_forward_refs() |
0 commit comments