credmark.cmf.types.compose.MapInputsResult

DTO class MapInputsResult(*, input, output=None, error=None)[source]

Bases: GenericModel, Generic[INPUTDTOCLS, DTOCLS]

A data row in an input series. The generic type specifies the classes to use as the input and output.

For example row = MapInputResult[MyInputClass, MyOutputClass](**data) where row.input will be an instance of MyInputClass and row.output will be an instance of MyOutputClass

Show JSON schema
{
   "title": "MapInputsResult",
   "description": "A data row in an input series.\nThe generic type specifies the classes to use as the input and output.\n\nFor example ``row = MapInputResult[MyInputClass, MyOutputClass](**data)``\nwhere ``row.input`` will be an instance of ``MyInputClass``\nand ``row.output`` will be an instance of ``MyOutputClass``",
   "type": "object",
   "properties": {
      "input": {
         "title": "Input",
         "description": "Input used for the run.",
         "anyOf": [
            {},
            {
               "type": "object"
            }
         ]
      },
      "output": {
         "title": "Output",
         "description": "Model output of result. Will not be present if there is an error."
      },
      "error": {
         "title": "Error",
         "description": "Error DTO from model run. Will not be present if output exists.",
         "allOf": [
            {
               "$ref": "#/definitions/ModelErrorDTO"
            }
         ]
      }
   },
   "required": [
      "input"
   ],
   "examples": [
      {
         "input": {
            "address": "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72"
         },
         "output": {
            "result": 42
         },
         "error": null
      }
   ],
   "definitions": {
      "ModelCallStackEntry": {
         "title": "ModelCallStackEntry",
         "description": "An item in an error's call stack.",
         "type": "object",
         "properties": {
            "slug": {
               "title": "Slug",
               "description": "Model slug",
               "type": "string"
            },
            "version": {
               "title": "Version",
               "description": "Model version",
               "type": "string"
            },
            "chainId": {
               "title": "Chainid",
               "description": "Context chain id",
               "type": "integer"
            },
            "blockNumber": {
               "title": "Blocknumber",
               "description": "Context block number",
               "type": "integer"
            },
            "input": {
               "title": "Input",
               "description": "Context input"
            },
            "trace": {
               "title": "Trace",
               "description": "Trace of code that generated the error",
               "type": "string"
            }
         },
         "required": [
            "slug",
            "version"
         ]
      },
      "ModelErrorDTO": {
         "title": "ModelErrorDTO",
         "description": "Data fields common to all error types:\nModelDataError, ModelRunError, ModelInputError etc.",
         "type": "object",
         "properties": {
            "type": {
               "title": "Type",
               "description": "Error type",
               "type": "string"
            },
            "message": {
               "title": "Message",
               "description": "Error message",
               "type": "string"
            },
            "stack": {
               "title": "Stack",
               "description": "Model call stack. Last element is the model that raised the error.",
               "default": [],
               "type": "array",
               "items": {
                  "$ref": "#/definitions/ModelCallStackEntry"
               }
            },
            "code": {
               "title": "Code",
               "description": "Short identifier for the type of error",
               "default": "generic",
               "type": "string"
            },
            "detail": {
               "title": "Detail",
               "description": "Arbitrary data object related to the error."
            },
            "permanent": {
               "title": "Permanent",
               "description": "If true, the error will always give the same result for the same context.",
               "default": false,
               "type": "boolean"
            }
         },
         "required": [
            "type",
            "message"
         ]
      }
   }
}

Config
  • schema_extra: dict = {‘examples’: [{‘input’: {‘address’: ‘0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72’}, ‘output’: {‘result’: 42}, ‘error’: None}]}

Fields
Parameters
Return type

None

field error: Optional[ModelErrorDTO] = None

Error DTO from model run. Will not be present if output exists.

field input: Union[INPUTDTOCLS, dict] [Required]

Input used for the run.

field output: Optional[DTOCLS] = None

Model output of result. Will not be present if there is an error.