Full Schema
Complete Morphir IR JSON Schema for format version 1
Format version 1 is the original Morphir IR format. It uses lowercase tag names throughout and has a different module structure compared to later versions.
Version 1 of the Morphir IR format uses lowercase tags for all constructs. This includes distribution types, access control levels, type tags, value expression tags, pattern tags, and literal tags.
All tags in version 1 are lowercase:
"library" (not "Library")"public" and "private" (not "Public" and "Private")"variable", "reference", "tuple", "record", etc."apply", "lambda", "let_definition", etc."as_pattern", "wildcard_pattern", "constructor_pattern", etc."bool_literal", "string_literal", "whole_number_literal", etc.In version 1, modules are represented as objects with name and def fields:
ModuleEntry:
type: object
required: ["name", "def"]
properties:
name:
$ref: "#/definitions/ModuleName"
def:
type: array
minItems: 2
maxItems: 2
items:
- $ref: "#/definitions/AccessLevel"
- $ref: "#/definitions/ModuleDefinition"
This differs from version 2+, where modules are represented as arrays: [modulePath, accessControlled].
The Morphir IR uses a sophisticated naming system independent of any specific naming convention.
A Name represents a human-readable identifier made up of one or more words.
["value", "in", "u", "s", "d"] renders as valueInUSD or value_in_USDName:
type: array
items:
type: string
pattern: "^[a-z][a-z0-9]*$"
minItems: 1
description: |
A Name is a list of lowercase words that represents a human-readable identifier.
Example: ["value", "in", "u", "s", "d"] can be rendered as valueInUSD or value_in_USD.
A Path represents a hierarchical location in the IR structure.
[["morphir"], ["s", "d", "k"], ["string"]] for the String modulePath:
type: array
items:
$ref: "#/definitions/Name"
minItems: 1
description: |
A Path is a list of Names representing a hierarchical location in the IR structure.
Provides globally unique identifiers for types and values.
[packagePath, modulePath, localName]FQName:
type: array
minItems: 3
maxItems: 3
items:
- $ref: "#/definitions/PackageName"
- $ref: "#/definitions/ModuleName"
- $ref: "#/definitions/Name"
Manages visibility of types and values.
"public" (visible externally) or "private" (package-only)"public", "private")AccessLevel:
type: string
enum: ["public", "private"]
A Distribution represents a complete, self-contained package with all dependencies.
["library", packageName, dependencies, packageDefinition]"library" tagdistribution:
type: array
minItems: 4
maxItems: 4
items:
- type: string
const: "library"
- $ref: "#/definitions/PackageName"
- $ref: "#/definitions/Dependencies"
- $ref: "#/definitions/PackageDefinition"
Complete implementation of a package with all details.
{"name": ..., "def": [accessLevel, moduleDefinition]}Public interface of a package.
In version 1, modules use an object structure with explicit name and def fields:
ModuleEntry:
type: object
required: ["name", "def"]
properties:
name:
$ref: "#/definitions/ModuleName"
def:
type: array
minItems: 2
maxItems: 2
items:
- $ref: "#/definitions/AccessLevel"
- $ref: "#/definitions/ModuleDefinition"
Complete implementation of a module.
Public interface of a module.
The type system is based on functional programming principles, supporting:
Version 1 note: All type tags are lowercase in version 1.
Represents a type variable (generic parameter).
["variable", attributes, name]a in List aVariableType:
type: array
minItems: 3
maxItems: 3
items:
- const: "variable"
- $ref: "#/definitions/Attributes"
- $ref: "#/definitions/Name"
Reference to another type or type alias.
["reference", attributes, fqName, typeArgs]String, List Int, Maybe aReferenceType:
type: array
minItems: 4
maxItems: 4
items:
- const: "reference"
- $ref: "#/definitions/Attributes"
- $ref: "#/definitions/FQName"
- type: array
items:
$ref: "#/definitions/Type"
Composition of multiple types in fixed order.
["tuple", attributes, elementTypes](Int, String, Bool)Composition of named fields with types.
["record", attributes, fields]{firstName: String, age: Int}Function type representation.
["function", attributes, argType, returnType]Int -> StringAn alias for another type.
["type_alias_specification", typeParams, aliasedType]type alias UserId = StringTagged union type (sum type).
["custom_type_specification", typeParams, constructors]type Result e a = Ok a | Err eType with unknown structure.
["opaque_type_specification", typeParams]All data and logic in Morphir are represented as value expressions.
Version 1 note: All value tags are lowercase in version 1.
Literal constant value.
["literal", attributes, literal]Reference to a variable in scope.
["variable", attributes, name]Reference to a defined value (function or constant).
["reference", attributes, fqName]Morphir.SDK.List.map, Basics.addFunction application.
["apply", attributes, function, argument]add 1 2 (nested apply nodes for currying)ApplyValue:
type: array
minItems: 4
maxItems: 4
items:
- const: "apply"
- $ref: "#/definitions/Attributes"
- $ref: "#/definitions/Value"
- $ref: "#/definitions/Value"
Anonymous function.
["lambda", attributes, argumentPattern, body]\x -> x + 1LambdaValue:
type: array
minItems: 4
maxItems: 4
items:
- const: "lambda"
- $ref: "#/definitions/Attributes"
- $ref: "#/definitions/Pattern"
- $ref: "#/definitions/Value"
Let binding introducing a single value.
["let_definition", attributes, bindingName, definition, inExpr]let x = 5 in x + xConditional expression.
["if_then_else", attributes, condition, thenBranch, elseBranch]if x > 0 then "positive" else "non-positive"Pattern matching with multiple cases.
["pattern_match", attributes, valueToMatch, cases]case maybeValue of Just x -> x; Nothing -> 0Used for destructuring and filtering values.
Version 1 note: All pattern tags are lowercase in version 1.
Matches any value without binding.
["wildcard_pattern", attributes]_Binds a name to a matched value.
["as_pattern", attributes, nestedPattern, variableName]as_pattern with wildcard_patternMatches specific type constructor and arguments.
["constructor_pattern", attributes, fqName, argPatterns]Just x matches Just with pattern xVersion 1 note: All literal tags are lowercase in version 1.
Boolean literal.
["bool_literal", boolean]true or falseBoolLiteral:
type: array
minItems: 2
maxItems: 2
items:
- const: "bool_literal"
- type: boolean
Text string literal.
["string_literal", string]"hello"StringLiteral:
type: array
minItems: 2
maxItems: 2
items:
- const: "string_literal"
- type: string
Integer literal.
["whole_number_literal", integer]42, -17When migrating from version 1 to version 2 or 3:
"library" → "Library""public" → "Public", "private" → "Private"{"name": ..., "def": ...} to [modulePath, accessControlled]"variable" → "Variable", etc.For the complete schema definition, see the full schema page.
Complete Morphir IR JSON Schema for format version 1
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.