Skip to content

EVE SDE Schema

Documentation for third-party developers

appliedProximityEffects.jsonl

Schema

  • _key (required): integer
    Range: 50176 .. 95625
  • dbuffs (required): array of object

    • _key (required): integer
      Range: 4 .. 2601
    • _value (required): number
      Range: -99.989998 .. 50000
  • delaySeconds (required): integer
    Range: 0 .. 60

  • radius (required): integer
    Range: 5000 .. 750000

Code snippets

// <auto-generated />
//
// To parse this JSON data, add NuGet 'System.Text.Json' then do:
//
//    using QuickType;
//
//    var appliedProximityEffect = AppliedProximityEffect.FromJson(jsonString);
#nullable enable
#pragma warning disable CS8618
#pragma warning disable CS8601
#pragma warning disable CS8602
#pragma warning disable CS8603

namespace QuickType
{
    using System;
    using System.Collections.Generic;

    using System.Text.Json;
    using System.Text.Json.Serialization;
    using System.Globalization;

    public partial class AppliedProximityEffect
    {
        [JsonPropertyName("_key")]
        public long Key { get; set; }

        [JsonPropertyName("dbuffs")]
        public Dbuff[] Dbuffs { get; set; }

        [JsonPropertyName("delaySeconds")]
        public long DelaySeconds { get; set; }

        [JsonPropertyName("radius")]
        public long Radius { get; set; }
    }

    public partial class Dbuff
    {
        [JsonPropertyName("_key")]
        public long Key { get; set; }

        [JsonPropertyName("_value")]
        [JsonConverter(typeof(MinMaxValueCheckConverter))]
        public double Value { get; set; }
    }

    public partial class AppliedProximityEffect
    {
        public static AppliedProximityEffect FromJson(string json) => JsonSerializer.Deserialize<AppliedProximityEffect>(json, QuickType.Converter.Settings);
    }

    public static class Serialize
    {
        public static string ToJson(this AppliedProximityEffect self) => JsonSerializer.Serialize(self, QuickType.Converter.Settings);
    }

    internal static class Converter
    {
        public static readonly JsonSerializerOptions Settings = new(JsonSerializerDefaults.General)
        {
            Converters =
            {
                new DateOnlyConverter(),
                new TimeOnlyConverter(),
                IsoDateTimeOffsetConverter.Singleton
            },
        };
    }

    internal class MinMaxValueCheckConverter : JsonConverter<double>
    {
        public override bool CanConvert(Type t) => t == typeof(double);

        public override double Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            var value = reader.GetDouble();
            if (value >= -99.989998 && value <= 50000)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type double");
        }

        public override void Write(Utf8JsonWriter writer, double value, JsonSerializerOptions options)
        {
            if (value >= -99.989998 && value <= 50000)
            {
                JsonSerializer.Serialize(writer, value, options);
                return;
            }
            throw new Exception("Cannot marshal type double");
        }

        public static readonly MinMaxValueCheckConverter Singleton = new MinMaxValueCheckConverter();
    }

    public class DateOnlyConverter : JsonConverter<DateOnly>
    {
        private readonly string serializationFormat;
        public DateOnlyConverter() : this(null) { }

        public DateOnlyConverter(string? serializationFormat)
        {
                this.serializationFormat = serializationFormat ?? "yyyy-MM-dd";
        }

        public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                var value = reader.GetString();
                return DateOnly.Parse(value!);
        }

        public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
                => writer.WriteStringValue(value.ToString(serializationFormat));
    }

    public class TimeOnlyConverter : JsonConverter<TimeOnly>
    {
        private readonly string serializationFormat;

        public TimeOnlyConverter() : this(null) { }

        public TimeOnlyConverter(string? serializationFormat)
        {
                this.serializationFormat = serializationFormat ?? "HH:mm:ss.fff";
        }

        public override TimeOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                var value = reader.GetString();
                return TimeOnly.Parse(value!);
        }

        public override void Write(Utf8JsonWriter writer, TimeOnly value, JsonSerializerOptions options)
                => writer.WriteStringValue(value.ToString(serializationFormat));
    }

    internal class IsoDateTimeOffsetConverter : JsonConverter<DateTimeOffset>
    {
        public override bool CanConvert(Type t) => t == typeof(DateTimeOffset);

        private const string DefaultDateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

        private DateTimeStyles _dateTimeStyles = DateTimeStyles.RoundtripKind;
        private string? _dateTimeFormat;
        private CultureInfo? _culture;

        public DateTimeStyles DateTimeStyles
        {
                get => _dateTimeStyles;
                set => _dateTimeStyles = value;
        }

        public string? DateTimeFormat
        {
                get => _dateTimeFormat ?? string.Empty;
                set => _dateTimeFormat = (string.IsNullOrEmpty(value)) ? null : value;
        }

        public CultureInfo Culture
        {
                get => _culture ?? CultureInfo.CurrentCulture;
                set => _culture = value;
        }

        public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSerializerOptions options)
        {
                string text;


                if ((_dateTimeStyles & DateTimeStyles.AdjustToUniversal) == DateTimeStyles.AdjustToUniversal
                        || (_dateTimeStyles & DateTimeStyles.AssumeUniversal) == DateTimeStyles.AssumeUniversal)
                {
                        value = value.ToUniversalTime();
                }

                text = value.ToString(_dateTimeFormat ?? DefaultDateTimeFormat, Culture);

                writer.WriteStringValue(text);
        }

        public override DateTimeOffset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
                string? dateText = reader.GetString();

                if (string.IsNullOrEmpty(dateText) == false)
                {
                        if (!string.IsNullOrEmpty(_dateTimeFormat))
                        {
                                return DateTimeOffset.ParseExact(dateText, _dateTimeFormat, Culture, _dateTimeStyles);
                        }
                        else
                        {
                                return DateTimeOffset.Parse(dateText, Culture, _dateTimeStyles);
                        }
                }
                else
                {
                        return default(DateTimeOffset);
                }
        }


        public static readonly IsoDateTimeOffsetConverter Singleton = new IsoDateTimeOffsetConverter();
    }
}
#pragma warning restore CS8618
#pragma warning restore CS8601
#pragma warning restore CS8602
#pragma warning restore CS8603
// Code generated from JSON Schema using quicktype. DO NOT EDIT.
// To parse and unparse this JSON data, add this code to your project and do:
//
//    appliedProximityEffect, err := UnmarshalAppliedProximityEffect(bytes)
//    bytes, err = appliedProximityEffect.Marshal()

package model

import "encoding/json"

func UnmarshalAppliedProximityEffect(data []byte) (AppliedProximityEffect, error) {
    var r AppliedProximityEffect
    err := json.Unmarshal(data, &r)
    return r, err
}

func (r *AppliedProximityEffect) Marshal() ([]byte, error) {
    return json.Marshal(r)
}

type AppliedProximityEffect struct {
    Key          int64   `json:"_key"`
    Dbuffs       []Dbuff `json:"dbuffs"`
    DelaySeconds int64   `json:"delaySeconds"`
    Radius       int64   `json:"radius"`
}

type Dbuff struct {
    Key   int64   `json:"_key"`
    Value float64 `json:"_value"`
}
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"_key":{"type":"integer","minimum":50176,"maximum":95625},"dbuffs":{"type":"array","items":{"type":"object","properties":{"_key":{"type":"integer","minimum":4,"maximum":2601},"_value":{"type":"number","minimum":-99.989998,"maximum":50000.0}},"required":["_key","_value"]},"minItems":1,"maxItems":8},"delaySeconds":{"type":"integer","minimum":0,"maximum":60},"radius":{"type":"integer","minimum":5000,"maximum":750000}},"required":["_key","dbuffs","delaySeconds","radius"]}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json                   = Json { allowStructuredMapKeys = true }
// val appliedProximityEffect = json.parse(AppliedProximityEffect.serializer(), jsonString)

package model

import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*

@Serializable
data class AppliedProximityEffect (
    @SerialName("_key")
    val key: Long,

    val dbuffs: List<Dbuff>,
    val delaySeconds: Long,
    val radius: Long
)

@Serializable
data class Dbuff (
    @SerialName("_key")
    val key: Long,

    @SerialName("_value")
    val value: Double
)
<?php

// This is an autogenerated file:AppliedProximityEffect

class AppliedProximityEffect {
    private int $key; // json:_key Required
    private array $dbuffs; // json:dbuffs Required
    private int $delaySeconds; // json:delaySeconds Required
    private int $radius; // json:radius Required

    /**
     * @param int $key
     * @param array $dbuffs
     * @param int $delaySeconds
     * @param int $radius
     */
    public function __construct(int $key, array $dbuffs, int $delaySeconds, int $radius) {
        $this->key = $key;
        $this->dbuffs = $dbuffs;
        $this->delaySeconds = $delaySeconds;
        $this->radius = $radius;
    }

    /**
     * @param int $value
     * @throws Exception
     * @return int
     */
    public static function fromKey(int $value): int {
        return $value; /*int*/
    }

    /**
     * @throws Exception
     * @return int
     */
    public function toKey(): int {
        if (AppliedProximityEffect::validateKey($this->key))  {
            return $this->key; /*int*/
        }
        throw new Exception('never get to this AppliedProximityEffect::key');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateKey(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:AppliedProximityEffect::key");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getKey(): int {
        if (AppliedProximityEffect::validateKey($this->key))  {
            return $this->key;
        }
        throw new Exception('never get to getKey AppliedProximityEffect::key');
    }

    /**
     * @return int
     */
    public static function sampleKey(): int {
        return 31; /*31:key*/
    }

    /**
     * @param array $value
     * @throws Exception
     * @return array
     */
    public static function fromDbuffs(array $value): array {
        return  array_map(function ($value) {
            return Dbuff::from($value); /*class*/
        }, $value);
    }

    /**
     * @throws Exception
     * @return array
     */
    public function toDbuffs(): array {
        if (AppliedProximityEffect::validateDbuffs($this->dbuffs))  {
            return array_map(function ($value) {
                return $value->to(); /*class*/
            }, $this->dbuffs);
        }
        throw new Exception('never get to this AppliedProximityEffect::dbuffs');
    }

    /**
     * @param array
     * @return bool
     * @throws Exception
     */
    public static function validateDbuffs(array $value): bool {
        if (!is_array($value)) {
            throw new Exception("Attribute Error:AppliedProximityEffect::dbuffs");
        }
        array_walk($value, function($value_v) {
            $value_v->validate();
        });
        return true;
    }

    /**
     * @throws Exception
     * @return array
     */
    public function getDbuffs(): array {
        if (AppliedProximityEffect::validateDbuffs($this->dbuffs))  {
            return $this->dbuffs;
        }
        throw new Exception('never get to getDbuffs AppliedProximityEffect::dbuffs');
    }

    /**
     * @return array
     */
    public static function sampleDbuffs(): array {
        return  array(
            Dbuff::sample() /*32:*/
        ); /* 32:dbuffs*/
    }

    /**
     * @param int $value
     * @throws Exception
     * @return int
     */
    public static function fromDelaySeconds(int $value): int {
        return $value; /*int*/
    }

    /**
     * @throws Exception
     * @return int
     */
    public function toDelaySeconds(): int {
        if (AppliedProximityEffect::validateDelaySeconds($this->delaySeconds))  {
            return $this->delaySeconds; /*int*/
        }
        throw new Exception('never get to this AppliedProximityEffect::delaySeconds');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateDelaySeconds(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:AppliedProximityEffect::delaySeconds");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getDelaySeconds(): int {
        if (AppliedProximityEffect::validateDelaySeconds($this->delaySeconds))  {
            return $this->delaySeconds;
        }
        throw new Exception('never get to getDelaySeconds AppliedProximityEffect::delaySeconds');
    }

    /**
     * @return int
     */
    public static function sampleDelaySeconds(): int {
        return 33; /*33:delaySeconds*/
    }

    /**
     * @param int $value
     * @throws Exception
     * @return int
     */
    public static function fromRadius(int $value): int {
        return $value; /*int*/
    }

    /**
     * @throws Exception
     * @return int
     */
    public function toRadius(): int {
        if (AppliedProximityEffect::validateRadius($this->radius))  {
            return $this->radius; /*int*/
        }
        throw new Exception('never get to this AppliedProximityEffect::radius');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateRadius(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:AppliedProximityEffect::radius");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getRadius(): int {
        if (AppliedProximityEffect::validateRadius($this->radius))  {
            return $this->radius;
        }
        throw new Exception('never get to getRadius AppliedProximityEffect::radius');
    }

    /**
     * @return int
     */
    public static function sampleRadius(): int {
        return 34; /*34:radius*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return AppliedProximityEffect::validateKey($this->key)
        || AppliedProximityEffect::validateDbuffs($this->dbuffs)
        || AppliedProximityEffect::validateDelaySeconds($this->delaySeconds)
        || AppliedProximityEffect::validateRadius($this->radius);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'dbuffs'} = $this->toDbuffs();
        $out->{'delaySeconds'} = $this->toDelaySeconds();
        $out->{'radius'} = $this->toRadius();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return AppliedProximityEffect
     * @throws Exception
     */
    public static function from(stdClass $obj): AppliedProximityEffect {
        return new AppliedProximityEffect(
         AppliedProximityEffect::fromKey($obj->{'_key'})
        ,AppliedProximityEffect::fromDbuffs($obj->{'dbuffs'})
        ,AppliedProximityEffect::fromDelaySeconds($obj->{'delaySeconds'})
        ,AppliedProximityEffect::fromRadius($obj->{'radius'})
        );
    }

    /**
     * @return AppliedProximityEffect
     */
    public static function sample(): AppliedProximityEffect {
        return new AppliedProximityEffect(
         AppliedProximityEffect::sampleKey()
        ,AppliedProximityEffect::sampleDbuffs()
        ,AppliedProximityEffect::sampleDelaySeconds()
        ,AppliedProximityEffect::sampleRadius()
        );
    }
}

// This is an autogenerated file:Dbuff

class Dbuff {
    private int $key; // json:_key Required
    private float $value; // json:_value Required

    /**
     * @param int $key
     * @param float $value
     */
    public function __construct(int $key, float $value) {
        $this->key = $key;
        $this->value = $value;
    }

    /**
     * @param int $value
     * @throws Exception
     * @return int
     */
    public static function fromKey(int $value): int {
        return $value; /*int*/
    }

    /**
     * @throws Exception
     * @return int
     */
    public function toKey(): int {
        if (Dbuff::validateKey($this->key))  {
            return $this->key; /*int*/
        }
        throw new Exception('never get to this Dbuff::key');
    }

    /**
     * @param int
     * @return bool
     * @throws Exception
     */
    public static function validateKey(int $value): bool {
        if (!is_integer($value)) {
            throw new Exception("Attribute Error:Dbuff::key");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return int
     */
    public function getKey(): int {
        if (Dbuff::validateKey($this->key))  {
            return $this->key;
        }
        throw new Exception('never get to getKey Dbuff::key');
    }

    /**
     * @return int
     */
    public static function sampleKey(): int {
        return 31; /*31:key*/
    }

    /**
     * @param float $value
     * @throws Exception
     * @return float
     */
    public static function fromValue(float $value): float {
        return $value; /*float*/
    }

    /**
     * @throws Exception
     * @return float
     */
    public function toValue(): float {
        if (Dbuff::validateValue($this->value))  {
            return $this->value; /*float*/
        }
        throw new Exception('never get to this Dbuff::value');
    }

    /**
     * @param float
     * @return bool
     * @throws Exception
     */
    public static function validateValue(float $value): bool {
        if (!is_float($value) && !is_int($value)) {
            throw new Exception("Attribute Error:Dbuff::value");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return float
     */
    public function getValue(): float {
        if (Dbuff::validateValue($this->value))  {
            return $this->value;
        }
        throw new Exception('never get to getValue Dbuff::value');
    }

    /**
     * @return float
     */
    public static function sampleValue(): float {
        return 32.032; /*32:value*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return Dbuff::validateKey($this->key)
        || Dbuff::validateValue($this->value);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'_value'} = $this->toValue();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return Dbuff
     * @throws Exception
     */
    public static function from(stdClass $obj): Dbuff {
        return new Dbuff(
         Dbuff::fromKey($obj->{'_key'})
        ,Dbuff::fromValue($obj->{'_value'})
        );
    }

    /**
     * @return Dbuff
     */
    public static function sample(): Dbuff {
        return new Dbuff(
         Dbuff::sampleKey()
        ,Dbuff::sampleValue()
        );
    }
}
from dataclasses import dataclass
from typing import Any, TypeVar, Callable, Type, cast


T = TypeVar("T")


def from_int(x: Any) -> int:
    assert isinstance(x, int) and not isinstance(x, bool)
    return x


def from_float(x: Any) -> float:
    assert isinstance(x, (float, int)) and not isinstance(x, bool)
    return float(x)


def to_float(x: Any) -> float:
    assert isinstance(x, (int, float))
    return x


def from_list(f: Callable[[Any], T], x: Any) -> list[T]:
    assert isinstance(x, list)
    return [f(y) for y in x]


def to_class(c: Type[T], x: Any) -> dict:
    assert isinstance(x, c)
    return cast(Any, x).to_dict()


@dataclass
class Dbuff:
    key: int
    value: float

    @staticmethod
    def from_dict(obj: Any) -> 'Dbuff':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        value = from_float(obj.get("_value"))
        return Dbuff(key, value)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["_value"] = to_float(self.value)
        return result


@dataclass
class AppliedProximityEffect:
    key: int
    dbuffs: list[Dbuff]
    delay_seconds: int
    radius: int

    @staticmethod
    def from_dict(obj: Any) -> 'AppliedProximityEffect':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        dbuffs = from_list(Dbuff.from_dict, obj.get("dbuffs"))
        delay_seconds = from_int(obj.get("delaySeconds"))
        radius = from_int(obj.get("radius"))
        return AppliedProximityEffect(key, dbuffs, delay_seconds, radius)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["dbuffs"] = from_list(lambda x: to_class(Dbuff, x), self.dbuffs)
        result["delaySeconds"] = from_int(self.delay_seconds)
        result["radius"] = from_int(self.radius)
        return result


def applied_proximity_effect_from_dict(s: Any) -> AppliedProximityEffect:
    return AppliedProximityEffect.from_dict(s)


def applied_proximity_effect_to_dict(x: AppliedProximityEffect) -> Any:
    return to_class(AppliedProximityEffect, x)
// To parse this data:
//
//   import { Convert, AppliedProximityEffect } from "./AppliedProximityEffect";
//
//   const appliedProximityEffect = Convert.toAppliedProximityEffect(json);
//
// These functions will throw an error if the JSON doesn't
// match the expected interface, even if the JSON is valid.

export interface AppliedProximityEffect {
    _key:         number;
    dbuffs:       [Dbuff, ...Dbuff[]];
    delaySeconds: number;
    radius:       number;
    [property: string]: unknown;
}

export interface Dbuff {
    _key:   number;
    _value: number;
    [property: string]: unknown;
}

// Converts JSON strings to/from your types
// and asserts the results of JSON.parse at runtime
export class Convert {
    public static toAppliedProximityEffect(json: string): AppliedProximityEffect {
        return cast(JSON.parse(json), r("AppliedProximityEffect"));
    }

    public static appliedProximityEffectToJson(value: AppliedProximityEffect): string {
        return JSON.stringify(uncast(value, r("AppliedProximityEffect")), null, 2);
    }
}

function invalidValue(typ: any, val: any, key: any, parent: any = ''): never {
    const prettyTyp = prettyTypeName(typ);
    const parentText = parent ? ` on ${parent}` : '';
    const keyText = key ? ` for key "${key}"` : '';
    throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
}

function prettyTypeName(typ: any): string {
    if (Array.isArray(typ)) {
        if (typ.length === 2 && typ[0] === undefined) {
            return `an optional ${prettyTypeName(typ[1])}`;
        } else {
            return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
        }
    } else if (typeof typ === "object" && typ.literal !== undefined) {
        return typ.literal;
    } else {
        return typeof typ;
    }
}

function jsonToJSProps(typ: any): any {
    if (typ.jsonToJS === undefined) {
        const map: any = {};
        typ.props.forEach((p: any) => map[p.json] = { key: p.js, typ: p.typ });
        typ.jsonToJS = map;
    }
    return typ.jsonToJS;
}

function jsToJSONProps(typ: any): any {
    if (typ.jsToJSON === undefined) {
        const map: any = {};
        typ.props.forEach((p: any) => map[p.js] = { key: p.json, typ: p.typ });
        typ.jsToJSON = map;
    }
    return typ.jsToJSON;
}

function transform(val: any, typ: any, getProps: any, key: any = '', parent: any = ''): any {
    function transformPrimitive(typ: string, val: any): any {
        if (typeof typ === typeof val) return val;
        return invalidValue(typ, val, key, parent);
    }

    function transformUnion(typs: any[], val: any): any {
        // val must validate against one typ in typs
        const l = typs.length;
        for (let i = 0; i < l; i++) {
            const typ = typs[i];
            try {
                return transform(val, typ, getProps);
            } catch (_) {}
        }
        return invalidValue(typs, val, key, parent);
    }

    function transformEnum(cases: string[], val: any): any {
        if (cases.indexOf(val) !== -1) return val;
        return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
    }

    function transformArray(typ: any, val: any): any {
        // val must be an array with no invalid elements
        if (!Array.isArray(val)) return invalidValue(l("array"), val, key, parent);
        return val.map(el => transform(el, typ, getProps));
    }

    function transformDate(val: any): any {
        if (val === null) {
            return null;
        }
        const d = new Date(val);
        if (isNaN(d.valueOf())) {
            return invalidValue(l("Date"), val, key, parent);
        }
        return d;
    }

    function transformObject(props: { [k: string]: any }, additional: any, val: any): any {
        if (val === null || typeof val !== "object" || Array.isArray(val)) {
            return invalidValue(l(ref || "object"), val, key, parent);
        }
        const result: any = {};
        Object.getOwnPropertyNames(props).forEach(key => {
            const prop = props[key];
            const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
            result[prop.key] = transform(v, prop.typ, getProps, key, ref);
        });
        Object.getOwnPropertyNames(val).forEach(key => {
            if (!Object.prototype.hasOwnProperty.call(props, key)) {
                result[key] = transform(val[key], additional, getProps, key, ref);
            }
        });
        return result;
    }

    if (typ === "any") return val;
    if (typ === null) {
        if (val === null) return val;
        return invalidValue(typ, val, key, parent);
    }
    if (typ === false) return invalidValue(typ, val, key, parent);
    let ref: any = undefined;
    while (typeof typ === "object" && typ.ref !== undefined) {
        ref = typ.ref;
        typ = typeMap[typ.ref];
    }
    if (Array.isArray(typ)) return transformEnum(typ, val);
    if (typeof typ === "object") {
        return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
            : typ.hasOwnProperty("arrayItems")    ? transformArray(typ.arrayItems, val)
            : typ.hasOwnProperty("props")         ? transformObject(getProps(typ), typ.additional, val)
            : invalidValue(typ, val, key, parent);
    }
    // Numbers can be parsed by Date but shouldn't be.
    if (typ === Date && typeof val !== "number") return transformDate(val);
    return transformPrimitive(typ, val);
}

function cast<T>(val: any, typ: any): T {
    return transform(val, typ, jsonToJSProps);
}

function uncast<T>(val: T, typ: any): any {
    return transform(val, typ, jsToJSONProps);
}

function l(typ: any) {
    return { literal: typ };
}

function a(typ: any) {
    return { arrayItems: typ };
}

function u(...typs: any[]) {
    return { unionMembers: typs };
}

function o(props: any[], additional: any) {
    return { props, additional };
}

function m(additional: any) {
    return { props: [], additional };
}

function r(name: string) {
    return { ref: name };
}

const typeMap: any = {
    "AppliedProximityEffect": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "dbuffs", js: "dbuffs", typ: a(r("Dbuff")) },
        { json: "delaySeconds", js: "delaySeconds", typ: 0 },
        { json: "radius", js: "radius", typ: 0 },
    ], "any"),
    "Dbuff": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "_value", js: "_value", typ: 3.14 },
    ], "any"),
};