Skip to content

EVE SDE Schema

Documentation for third-party developers

mapConstellations.jsonl

Schema

  • _key (required): integer
    Range: 20000001 .. 26000001
  • factionID: integer
    Range: 500001 .. 500026
  • name (required): object

    • de (required): string
    • en (required): string
    • es (required): string
    • fr (required): string
    • ja (required): string
    • ko (required): string
    • ru (required): string
    • zh (required): string
  • position (required): object

    • x (required): number
      Range: -5543305663215762400 .. 8230245765685670900
    • y (required): number
      Range: -60129751947834528 .. 6032347345900023800
    • z (required): number
      Range: -10034758325050604000 .. 468006802398912700
  • regionID (required): integer
    Range: 10000001 .. 19000001

  • solarSystemIDs (required): array of integer
    Type: integer
    Range: 30000001 .. 36000001
  • wormholeClassID: integer
    Range: 1 .. 25

Code snippets

// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
//    using QuickType;
//
//    var mapConstellation = MapConstellation.FromJson(jsonString);

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

    using System.Globalization;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Converters;

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

        [JsonProperty("factionID", NullValueHandling = NullValueHandling.Ignore)]
        public long? FactionId { get; set; }

        [JsonProperty("name")]
        public Name Name { get; set; }

        [JsonProperty("position")]
        public Position Position { get; set; }

        [JsonProperty("regionID")]
        public long RegionId { get; set; }

        [JsonProperty("solarSystemIDs")]
        public long[] SolarSystemIDs { get; set; }

        [JsonProperty("wormholeClassID", NullValueHandling = NullValueHandling.Ignore)]
        public long? WormholeClassId { get; set; }
    }

    public partial class Name
    {
        [JsonProperty("de")]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string De { get; set; }

        [JsonProperty("en")]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string En { get; set; }

        [JsonProperty("es")]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string Es { get; set; }

        [JsonProperty("fr")]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string Fr { get; set; }

        [JsonProperty("ja")]
        [JsonConverter(typeof(FluffyMinMaxLengthCheckConverter))]
        public string Ja { get; set; }

        [JsonProperty("ko")]
        [JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
        public string Ko { get; set; }

        [JsonProperty("ru")]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string Ru { get; set; }

        [JsonProperty("zh")]
        [JsonConverter(typeof(TentacledMinMaxLengthCheckConverter))]
        public string Zh { get; set; }
    }

    public partial class Position
    {
        [JsonProperty("x")]
        [JsonConverter(typeof(PurpleMinMaxValueCheckConverter))]
        public double X { get; set; }

        [JsonProperty("y")]
        [JsonConverter(typeof(FluffyMinMaxValueCheckConverter))]
        public double Y { get; set; }

        [JsonProperty("z")]
        [JsonConverter(typeof(TentacledMinMaxValueCheckConverter))]
        public double Z { get; set; }
    }

    public partial class MapConstellation
    {
        public static MapConstellation FromJson(string json) => JsonConvert.DeserializeObject<MapConstellation>(json, QuickType.Converter.Settings);
    }

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

    internal static class Converter
    {
        public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
        {
            MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
            DateParseHandling = DateParseHandling.None,
            Converters =
            {
                new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
            },
        };
    }

    internal class PurpleMinMaxLengthCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            var value = serializer.Deserialize<string>(reader);
            if (value.Length >= 3 && value.Length <= 20)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            var value = (string)untypedValue;
            if (value.Length >= 3 && value.Length <= 20)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

    internal class FluffyMinMaxLengthCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            var value = serializer.Deserialize<string>(reader);
            if (value.Length >= 2 && value.Length <= 11)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            var value = (string)untypedValue;
            if (value.Length >= 2 && value.Length <= 11)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

    internal class TentacledMinMaxLengthCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(string);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            var value = serializer.Deserialize<string>(reader);
            if (value.Length >= 1 && value.Length <= 8)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type string");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            var value = (string)untypedValue;
            if (value.Length >= 1 && value.Length <= 8)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

    internal class PurpleMinMaxValueCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null) return null;
            var value = serializer.Deserialize<double>(reader);
            if (value >= -5543305663215762000 && value <= 8230245765685671000)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type double");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            if (untypedValue == null)
            {
                serializer.Serialize(writer, null);
                return;
            }
            var value = (double)untypedValue;
            if (value >= -5543305663215762000 && value <= 8230245765685671000)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type double");
        }

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

    internal class FluffyMinMaxValueCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null) return null;
            var value = serializer.Deserialize<double>(reader);
            if (value >= -60129751947834530 && value <= 6032347345900024000)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type double");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            if (untypedValue == null)
            {
                serializer.Serialize(writer, null);
                return;
            }
            var value = (double)untypedValue;
            if (value >= -60129751947834530 && value <= 6032347345900024000)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type double");
        }

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

    internal class TentacledMinMaxValueCheckConverter : JsonConverter
    {
        public override bool CanConvert(Type t) => t == typeof(double) || t == typeof(double?);

        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null) return null;
            var value = serializer.Deserialize<double>(reader);
            if (value >= -10034758325050604000 && value <= 468006802398912700)
            {
                return value;
            }
            throw new Exception("Cannot unmarshal type double");
        }

        public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer)
        {
            if (untypedValue == null)
            {
                serializer.Serialize(writer, null);
                return;
            }
            var value = (double)untypedValue;
            if (value >= -10034758325050604000 && value <= 468006802398912700)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type double");
        }

        public static readonly TentacledMinMaxValueCheckConverter Singleton = new TentacledMinMaxValueCheckConverter();
    }
}
// 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:
//
//    mapConstellation, err := UnmarshalMapConstellation(bytes)
//    bytes, err = mapConstellation.Marshal()

package model

import "encoding/json"

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

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

type MapConstellation struct {
    Key             int64    `json:"_key"`
    FactionID       *int64   `json:"factionID,omitempty"`
    Name            Name     `json:"name"`
    Position        Position `json:"position"`
    RegionID        int64    `json:"regionID"`
    SolarSystemIDs  []int64  `json:"solarSystemIDs"`
    WormholeClassID *int64   `json:"wormholeClassID,omitempty"`
}

type Name struct {
    De string `json:"de"`
    En string `json:"en"`
    Es string `json:"es"`
    Fr string `json:"fr"`
    Ja string `json:"ja"`
    Ko string `json:"ko"`
    Ru string `json:"ru"`
    Zh string `json:"zh"`
}

type Position struct {
    X float64 `json:"x"`
    Y float64 `json:"y"`
    Z float64 `json:"z"`
}
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
        "_key": {
            "type": "integer",
            "minimum": 20000001,
            "maximum": 26000001
        },
        "factionID": {
            "type": "integer",
            "minimum": 500001,
            "maximum": 500026
        },
        "name": {
            "type": "object",
            "properties": {
                "de": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 20
                },
                "en": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 20
                },
                "es": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 20
                },
                "fr": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 20
                },
                "ja": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 11
                },
                "ko": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8
                },
                "ru": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 20
                },
                "zh": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 8
                }
            },
            "required": [
                "de",
                "en",
                "es",
                "fr",
                "ja",
                "ko",
                "ru",
                "zh"
            ]
        },
        "position": {
            "type": "object",
            "properties": {
                "x": {
                    "type": "number",
                    "minimum": -5.5433056632157624E18,
                    "maximum": 8.2302457656856709E18
                },
                "y": {
                    "type": "number",
                    "minimum": -6.0129751947834528E16,
                    "maximum": 6.0323473459000238E18
                },
                "z": {
                    "type": "number",
                    "minimum": -1.0034758325050604E19,
                    "maximum": 4.680068023989127E17
                }
            },
            "required": [
                "x",
                "y",
                "z"
            ]
        },
        "regionID": {
            "type": "integer",
            "minimum": 10000001,
            "maximum": 19000001
        },
        "solarSystemIDs": {
            "type": "array",
            "items": {
                "type": "integer",
                "minimum": 30000001,
                "maximum": 36000001
            },
            "minItems": 1,
            "maxItems": 19
        },
        "wormholeClassID": {
            "type": "integer",
            "minimum": 1,
            "maximum": 25
        }
    },
    "required": [
        "_key",
        "name",
        "position",
        "regionID",
        "solarSystemIDs"
    ]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json             = Json { allowStructuredMapKeys = true }
// val mapConstellation = json.parse(MapConstellation.serializer(), jsonString)

package model

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

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

    @SerialName("factionID")
    val factionId: Long? = null,

    val name: Name,
    val position: Position,

    @SerialName("regionID")
    val regionId: Long,

    val solarSystemIDs: List<Long>,

    @SerialName("wormholeClassID")
    val wormholeClassId: Long? = null
)

@Serializable
data class Name (
    val de: String,
    val en: String,
    val es: String,
    val fr: String,
    val ja: String,
    val ko: String,
    val ru: String,
    val zh: String
)

@Serializable
data class Position (
    val x: Double,
    val y: Double,
    val z: Double
)
<?php

// This is a autogenerated file:MapConstellation

class MapConstellation {
    private int $key; // json:_key Required
    private ?int $factionId; // json:factionID Optional
    private Name $name; // json:name Required
    private Position $position; // json:position Required
    private int $regionId; // json:regionID Required
    private array $solarSystemIDs; // json:solarSystemIDs Required
    private ?int $wormholeClassId; // json:wormholeClassID Optional

    /**
     * @param int $key
     * @param int|null $factionId
     * @param Name $name
     * @param Position $position
     * @param int $regionId
     * @param array $solarSystemIDs
     * @param int|null $wormholeClassId
     */
    public function __construct(int $key, ?int $factionId, Name $name, Position $position, int $regionId, array $solarSystemIDs, ?int $wormholeClassId) {
        $this->key = $key;
        $this->factionId = $factionId;
        $this->name = $name;
        $this->position = $position;
        $this->regionId = $regionId;
        $this->solarSystemIDs = $solarSystemIDs;
        $this->wormholeClassId = $wormholeClassId;
    }

    /**
     * @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 (MapConstellation::validateKey($this->key))  {
            return $this->key; /*int*/
        }
        throw new Exception('never get to this MapConstellation::key');
    }

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

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

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

    /**
     * @param ?int $value
     * @throws Exception
     * @return ?int
     */
    public static function fromFactionId(?int $value): ?int {
        if (!is_null($value)) {
            return $value; /*int*/
        } else {
            return null;
        }
    }

    /**
     * @throws Exception
     * @return ?int
     */
    public function toFactionId(): ?int {
        if (MapConstellation::validateFactionId($this->factionId))  {
            if (!is_null($this->factionId)) {
                return $this->factionId; /*int*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this MapConstellation::factionId');
    }

    /**
     * @param int|null
     * @return bool
     * @throws Exception
     */
    public static function validateFactionId(?int $value): bool {
        if (!is_null($value)) {
            if (!is_integer($value)) {
                throw new Exception("Attribute Error:MapConstellation::factionId");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?int
     */
    public function getFactionId(): ?int {
        if (MapConstellation::validateFactionId($this->factionId))  {
            return $this->factionId;
        }
        throw new Exception('never get to getFactionId MapConstellation::factionId');
    }

    /**
     * @return ?int
     */
    public static function sampleFactionId(): ?int {
        return 32; /*32:factionId*/
    }

    /**
     * @param stdClass $value
     * @throws Exception
     * @return Name
     */
    public static function fromName(stdClass $value): Name {
        return Name::from($value); /*class*/
    }

    /**
     * @throws Exception
     * @return stdClass
     */
    public function toName(): stdClass {
        if (MapConstellation::validateName($this->name))  {
            return $this->name->to(); /*class*/
        }
        throw new Exception('never get to this MapConstellation::name');
    }

    /**
     * @param Name
     * @return bool
     * @throws Exception
     */
    public static function validateName(Name $value): bool {
        $value->validate();
        return true;
    }

    /**
     * @throws Exception
     * @return Name
     */
    public function getName(): Name {
        if (MapConstellation::validateName($this->name))  {
            return $this->name;
        }
        throw new Exception('never get to getName MapConstellation::name');
    }

    /**
     * @return Name
     */
    public static function sampleName(): Name {
        return Name::sample(); /*33:name*/
    }

    /**
     * @param stdClass $value
     * @throws Exception
     * @return Position
     */
    public static function fromPosition(stdClass $value): Position {
        return Position::from($value); /*class*/
    }

    /**
     * @throws Exception
     * @return stdClass
     */
    public function toPosition(): stdClass {
        if (MapConstellation::validatePosition($this->position))  {
            return $this->position->to(); /*class*/
        }
        throw new Exception('never get to this MapConstellation::position');
    }

    /**
     * @param Position
     * @return bool
     * @throws Exception
     */
    public static function validatePosition(Position $value): bool {
        $value->validate();
        return true;
    }

    /**
     * @throws Exception
     * @return Position
     */
    public function getPosition(): Position {
        if (MapConstellation::validatePosition($this->position))  {
            return $this->position;
        }
        throw new Exception('never get to getPosition MapConstellation::position');
    }

    /**
     * @return Position
     */
    public static function samplePosition(): Position {
        return Position::sample(); /*34:position*/
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function toRegionId(): int {
        if (MapConstellation::validateRegionId($this->regionId))  {
            return $this->regionId; /*int*/
        }
        throw new Exception('never get to this MapConstellation::regionId');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getRegionId(): int {
        if (MapConstellation::validateRegionId($this->regionId))  {
            return $this->regionId;
        }
        throw new Exception('never get to getRegionId MapConstellation::regionId');
    }

    /**
     * @return int
     */
    public static function sampleRegionId(): int {
        return 35; /*35:regionId*/
    }

    /**
     * @param array $value
     * @throws Exception
     * @return array
     */
    public static function fromSolarSystemIDs(array $value): array {
        return  array_map(function ($value) {
            return $value; /*int*/
        }, $value);
    }

    /**
     * @throws Exception
     * @return array
     */
    public function toSolarSystemIDs(): array {
        if (MapConstellation::validateSolarSystemIDs($this->solarSystemIDs))  {
            return array_map(function ($value) {
                return $value; /*int*/
            }, $this->solarSystemIDs);
        }
        throw new Exception('never get to this MapConstellation::solarSystemIDs');
    }

    /**
     * @param array
     * @return bool
     * @throws Exception
     */
    public static function validateSolarSystemIDs(array $value): bool {
        if (!is_array($value)) {
            throw new Exception("Attribute Error:MapConstellation::solarSystemIDs");
        }
        array_walk($value, function($value_v) {
            if (!is_integer($value_v)) {
                throw new Exception("Attribute Error:MapConstellation::solarSystemIDs");
            }
        });
        return true;
    }

    /**
     * @throws Exception
     * @return array
     */
    public function getSolarSystemIDs(): array {
        if (MapConstellation::validateSolarSystemIDs($this->solarSystemIDs))  {
            return $this->solarSystemIDs;
        }
        throw new Exception('never get to getSolarSystemIDs MapConstellation::solarSystemIDs');
    }

    /**
     * @return array
     */
    public static function sampleSolarSystemIDs(): array {
        return  array(
            36 /*36:*/
        ); /* 36:solarSystemIDs*/
    }

    /**
     * @param ?int $value
     * @throws Exception
     * @return ?int
     */
    public static function fromWormholeClassId(?int $value): ?int {
        if (!is_null($value)) {
            return $value; /*int*/
        } else {
            return null;
        }
    }

    /**
     * @throws Exception
     * @return ?int
     */
    public function toWormholeClassId(): ?int {
        if (MapConstellation::validateWormholeClassId($this->wormholeClassId))  {
            if (!is_null($this->wormholeClassId)) {
                return $this->wormholeClassId; /*int*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this MapConstellation::wormholeClassId');
    }

    /**
     * @param int|null
     * @return bool
     * @throws Exception
     */
    public static function validateWormholeClassId(?int $value): bool {
        if (!is_null($value)) {
            if (!is_integer($value)) {
                throw new Exception("Attribute Error:MapConstellation::wormholeClassId");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?int
     */
    public function getWormholeClassId(): ?int {
        if (MapConstellation::validateWormholeClassId($this->wormholeClassId))  {
            return $this->wormholeClassId;
        }
        throw new Exception('never get to getWormholeClassId MapConstellation::wormholeClassId');
    }

    /**
     * @return ?int
     */
    public static function sampleWormholeClassId(): ?int {
        return 37; /*37:wormholeClassId*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return MapConstellation::validateKey($this->key)
        || MapConstellation::validateFactionId($this->factionId)
        || MapConstellation::validateName($this->name)
        || MapConstellation::validatePosition($this->position)
        || MapConstellation::validateRegionId($this->regionId)
        || MapConstellation::validateSolarSystemIDs($this->solarSystemIDs)
        || MapConstellation::validateWormholeClassId($this->wormholeClassId);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'_key'} = $this->toKey();
        $out->{'factionID'} = $this->toFactionId();
        $out->{'name'} = $this->toName();
        $out->{'position'} = $this->toPosition();
        $out->{'regionID'} = $this->toRegionId();
        $out->{'solarSystemIDs'} = $this->toSolarSystemIDs();
        $out->{'wormholeClassID'} = $this->toWormholeClassId();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return MapConstellation
     * @throws Exception
     */
    public static function from(stdClass $obj): MapConstellation {
        return new MapConstellation(
         MapConstellation::fromKey($obj->{'_key'})
        ,MapConstellation::fromFactionId($obj->{'factionID'})
        ,MapConstellation::fromName($obj->{'name'})
        ,MapConstellation::fromPosition($obj->{'position'})
        ,MapConstellation::fromRegionId($obj->{'regionID'})
        ,MapConstellation::fromSolarSystemIDs($obj->{'solarSystemIDs'})
        ,MapConstellation::fromWormholeClassId($obj->{'wormholeClassID'})
        );
    }

    /**
     * @return MapConstellation
     */
    public static function sample(): MapConstellation {
        return new MapConstellation(
         MapConstellation::sampleKey()
        ,MapConstellation::sampleFactionId()
        ,MapConstellation::sampleName()
        ,MapConstellation::samplePosition()
        ,MapConstellation::sampleRegionId()
        ,MapConstellation::sampleSolarSystemIDs()
        ,MapConstellation::sampleWormholeClassId()
        );
    }
}

// This is a autogenerated file:Name

class Name {
    private string $de; // json:de Required
    private string $en; // json:en Required
    private string $es; // json:es Required
    private string $fr; // json:fr Required
    private string $ja; // json:ja Required
    private string $ko; // json:ko Required
    private string $ru; // json:ru Required
    private string $zh; // json:zh Required

    /**
     * @param string $de
     * @param string $en
     * @param string $es
     * @param string $fr
     * @param string $ja
     * @param string $ko
     * @param string $ru
     * @param string $zh
     */
    public function __construct(string $de, string $en, string $es, string $fr, string $ja, string $ko, string $ru, string $zh) {
        $this->de = $de;
        $this->en = $en;
        $this->es = $es;
        $this->fr = $fr;
        $this->ja = $ja;
        $this->ko = $ko;
        $this->ru = $ru;
        $this->zh = $zh;
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toDe(): string {
        if (Name::validateDe($this->de))  {
            return $this->de; /*string*/
        }
        throw new Exception('never get to this Name::de');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateDe(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:Name::de");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getDe(): string {
        if (Name::validateDe($this->de))  {
            return $this->de;
        }
        throw new Exception('never get to getDe Name::de');
    }

    /**
     * @return string
     */
    public static function sampleDe(): string {
        return 'Name::de::31'; /*31:de*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toEn(): string {
        if (Name::validateEn($this->en))  {
            return $this->en; /*string*/
        }
        throw new Exception('never get to this Name::en');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateEn(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:Name::en");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getEn(): string {
        if (Name::validateEn($this->en))  {
            return $this->en;
        }
        throw new Exception('never get to getEn Name::en');
    }

    /**
     * @return string
     */
    public static function sampleEn(): string {
        return 'Name::en::32'; /*32:en*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toEs(): string {
        if (Name::validateEs($this->es))  {
            return $this->es; /*string*/
        }
        throw new Exception('never get to this Name::es');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateEs(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:Name::es");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getEs(): string {
        if (Name::validateEs($this->es))  {
            return $this->es;
        }
        throw new Exception('never get to getEs Name::es');
    }

    /**
     * @return string
     */
    public static function sampleEs(): string {
        return 'Name::es::33'; /*33:es*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toFr(): string {
        if (Name::validateFr($this->fr))  {
            return $this->fr; /*string*/
        }
        throw new Exception('never get to this Name::fr');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateFr(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:Name::fr");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getFr(): string {
        if (Name::validateFr($this->fr))  {
            return $this->fr;
        }
        throw new Exception('never get to getFr Name::fr');
    }

    /**
     * @return string
     */
    public static function sampleFr(): string {
        return 'Name::fr::34'; /*34:fr*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toJa(): string {
        if (Name::validateJa($this->ja))  {
            return $this->ja; /*string*/
        }
        throw new Exception('never get to this Name::ja');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateJa(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:Name::ja");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getJa(): string {
        if (Name::validateJa($this->ja))  {
            return $this->ja;
        }
        throw new Exception('never get to getJa Name::ja');
    }

    /**
     * @return string
     */
    public static function sampleJa(): string {
        return 'Name::ja::35'; /*35:ja*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toKo(): string {
        if (Name::validateKo($this->ko))  {
            return $this->ko; /*string*/
        }
        throw new Exception('never get to this Name::ko');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateKo(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:Name::ko");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getKo(): string {
        if (Name::validateKo($this->ko))  {
            return $this->ko;
        }
        throw new Exception('never get to getKo Name::ko');
    }

    /**
     * @return string
     */
    public static function sampleKo(): string {
        return 'Name::ko::36'; /*36:ko*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toRu(): string {
        if (Name::validateRu($this->ru))  {
            return $this->ru; /*string*/
        }
        throw new Exception('never get to this Name::ru');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateRu(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:Name::ru");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getRu(): string {
        if (Name::validateRu($this->ru))  {
            return $this->ru;
        }
        throw new Exception('never get to getRu Name::ru');
    }

    /**
     * @return string
     */
    public static function sampleRu(): string {
        return 'Name::ru::37'; /*37:ru*/
    }

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

    /**
     * @throws Exception
     * @return string
     */
    public function toZh(): string {
        if (Name::validateZh($this->zh))  {
            return $this->zh; /*string*/
        }
        throw new Exception('never get to this Name::zh');
    }

    /**
     * @param string
     * @return bool
     * @throws Exception
     */
    public static function validateZh(string $value): bool {
        if (!is_string($value)) {
            throw new Exception("Attribute Error:Name::zh");
        }
        return true;
    }

    /**
     * @throws Exception
     * @return string
     */
    public function getZh(): string {
        if (Name::validateZh($this->zh))  {
            return $this->zh;
        }
        throw new Exception('never get to getZh Name::zh');
    }

    /**
     * @return string
     */
    public static function sampleZh(): string {
        return 'Name::zh::38'; /*38:zh*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return Name::validateDe($this->de)
        || Name::validateEn($this->en)
        || Name::validateEs($this->es)
        || Name::validateFr($this->fr)
        || Name::validateJa($this->ja)
        || Name::validateKo($this->ko)
        || Name::validateRu($this->ru)
        || Name::validateZh($this->zh);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'de'} = $this->toDe();
        $out->{'en'} = $this->toEn();
        $out->{'es'} = $this->toEs();
        $out->{'fr'} = $this->toFr();
        $out->{'ja'} = $this->toJa();
        $out->{'ko'} = $this->toKo();
        $out->{'ru'} = $this->toRu();
        $out->{'zh'} = $this->toZh();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return Name
     * @throws Exception
     */
    public static function from(stdClass $obj): Name {
        return new Name(
         Name::fromDe($obj->{'de'})
        ,Name::fromEn($obj->{'en'})
        ,Name::fromEs($obj->{'es'})
        ,Name::fromFr($obj->{'fr'})
        ,Name::fromJa($obj->{'ja'})
        ,Name::fromKo($obj->{'ko'})
        ,Name::fromRu($obj->{'ru'})
        ,Name::fromZh($obj->{'zh'})
        );
    }

    /**
     * @return Name
     */
    public static function sample(): Name {
        return new Name(
         Name::sampleDe()
        ,Name::sampleEn()
        ,Name::sampleEs()
        ,Name::sampleFr()
        ,Name::sampleJa()
        ,Name::sampleKo()
        ,Name::sampleRu()
        ,Name::sampleZh()
        );
    }
}

// This is a autogenerated file:Position

class Position {
    private float $x; // json:x Required
    private float $y; // json:y Required
    private float $z; // json:z Required

    /**
     * @param float $x
     * @param float $y
     * @param float $z
     */
    public function __construct(float $x, float $y, float $z) {
        $this->x = $x;
        $this->y = $y;
        $this->z = $z;
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toX(): float {
        if (Position::validateX($this->x))  {
            return $this->x; /*float*/
        }
        throw new Exception('never get to this Position::x');
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function getX(): float {
        if (Position::validateX($this->x))  {
            return $this->x;
        }
        throw new Exception('never get to getX Position::x');
    }

    /**
     * @return float
     */
    public static function sampleX(): float {
        return 31.031; /*31:x*/
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function toY(): float {
        if (Position::validateY($this->y))  {
            return $this->y; /*float*/
        }
        throw new Exception('never get to this Position::y');
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function getY(): float {
        if (Position::validateY($this->y))  {
            return $this->y;
        }
        throw new Exception('never get to getY Position::y');
    }

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

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

    /**
     * @throws Exception
     * @return float
     */
    public function toZ(): float {
        if (Position::validateZ($this->z))  {
            return $this->z; /*float*/
        }
        throw new Exception('never get to this Position::z');
    }

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

    /**
     * @throws Exception
     * @return float
     */
    public function getZ(): float {
        if (Position::validateZ($this->z))  {
            return $this->z;
        }
        throw new Exception('never get to getZ Position::z');
    }

    /**
     * @return float
     */
    public static function sampleZ(): float {
        return 33.033; /*33:z*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return Position::validateX($this->x)
        || Position::validateY($this->y)
        || Position::validateZ($this->z);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'x'} = $this->toX();
        $out->{'y'} = $this->toY();
        $out->{'z'} = $this->toZ();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return Position
     * @throws Exception
     */
    public static function from(stdClass $obj): Position {
        return new Position(
         Position::fromX($obj->{'x'})
        ,Position::fromY($obj->{'y'})
        ,Position::fromZ($obj->{'z'})
        );
    }

    /**
     * @return Position
     */
    public static function sample(): Position {
        return new Position(
         Position::sampleX()
        ,Position::sampleY()
        ,Position::sampleZ()
        );
    }
}
from typing import Any, Optional, List, TypeVar, Callable, Type, cast


T = TypeVar("T")


def from_str(x: Any) -> str:
    assert isinstance(x, str)
    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_int(x: Any) -> int:
    assert isinstance(x, int) and not isinstance(x, bool)
    return x


def from_none(x: Any) -> Any:
    assert x is None
    return x


def from_union(fs, x):
    for f in fs:
        try:
            return f(x)
        except:
            pass
    assert False


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()


class Name:
    de: str
    en: str
    es: str
    fr: str
    ja: str
    ko: str
    ru: str
    zh: str

    def __init__(self, de: str, en: str, es: str, fr: str, ja: str, ko: str, ru: str, zh: str) -> None:
        self.de = de
        self.en = en
        self.es = es
        self.fr = fr
        self.ja = ja
        self.ko = ko
        self.ru = ru
        self.zh = zh

    @staticmethod
    def from_dict(obj: Any) -> 'Name':
        assert isinstance(obj, dict)
        de = from_str(obj.get("de"))
        en = from_str(obj.get("en"))
        es = from_str(obj.get("es"))
        fr = from_str(obj.get("fr"))
        ja = from_str(obj.get("ja"))
        ko = from_str(obj.get("ko"))
        ru = from_str(obj.get("ru"))
        zh = from_str(obj.get("zh"))
        return Name(de, en, es, fr, ja, ko, ru, zh)

    def to_dict(self) -> dict:
        result: dict = {}
        result["de"] = from_str(self.de)
        result["en"] = from_str(self.en)
        result["es"] = from_str(self.es)
        result["fr"] = from_str(self.fr)
        result["ja"] = from_str(self.ja)
        result["ko"] = from_str(self.ko)
        result["ru"] = from_str(self.ru)
        result["zh"] = from_str(self.zh)
        return result


class Position:
    x: float
    y: float
    z: float

    def __init__(self, x: float, y: float, z: float) -> None:
        self.x = x
        self.y = y
        self.z = z

    @staticmethod
    def from_dict(obj: Any) -> 'Position':
        assert isinstance(obj, dict)
        x = from_float(obj.get("x"))
        y = from_float(obj.get("y"))
        z = from_float(obj.get("z"))
        return Position(x, y, z)

    def to_dict(self) -> dict:
        result: dict = {}
        result["x"] = to_float(self.x)
        result["y"] = to_float(self.y)
        result["z"] = to_float(self.z)
        return result


class MapConstellation:
    key: int
    faction_id: Optional[int]
    name: Name
    position: Position
    region_id: int
    solar_system_i_ds: List[int]
    wormhole_class_id: Optional[int]

    def __init__(self, key: int, faction_id: Optional[int], name: Name, position: Position, region_id: int, solar_system_i_ds: List[int], wormhole_class_id: Optional[int]) -> None:
        self.key = key
        self.faction_id = faction_id
        self.name = name
        self.position = position
        self.region_id = region_id
        self.solar_system_i_ds = solar_system_i_ds
        self.wormhole_class_id = wormhole_class_id

    @staticmethod
    def from_dict(obj: Any) -> 'MapConstellation':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        faction_id = from_union([from_int, from_none], obj.get("factionID"))
        name = Name.from_dict(obj.get("name"))
        position = Position.from_dict(obj.get("position"))
        region_id = from_int(obj.get("regionID"))
        solar_system_i_ds = from_list(from_int, obj.get("solarSystemIDs"))
        wormhole_class_id = from_union([from_int, from_none], obj.get("wormholeClassID"))
        return MapConstellation(key, faction_id, name, position, region_id, solar_system_i_ds, wormhole_class_id)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        if self.faction_id is not None:
            result["factionID"] = from_union([from_int, from_none], self.faction_id)
        result["name"] = to_class(Name, self.name)
        result["position"] = to_class(Position, self.position)
        result["regionID"] = from_int(self.region_id)
        result["solarSystemIDs"] = from_list(from_int, self.solar_system_i_ds)
        if self.wormhole_class_id is not None:
            result["wormholeClassID"] = from_union([from_int, from_none], self.wormhole_class_id)
        return result


def map_constellation_from_dict(s: Any) -> MapConstellation:
    return MapConstellation.from_dict(s)


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

export interface MapConstellation {
    _key:             number;
    factionID?:       number;
    name:             Name;
    position:         Position;
    regionID:         number;
    solarSystemIDs:   number[];
    wormholeClassID?: number;
    [property: string]: any;
}

export interface Name {
    de: string;
    en: string;
    es: string;
    fr: string;
    ja: string;
    ko: string;
    ru: string;
    zh: string;
    [property: string]: any;
}

export interface Position {
    x: number;
    y: number;
    z: number;
    [property: string]: any;
}

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

    public static mapConstellationToJson(value: MapConstellation): string {
        return JSON.stringify(uncast(value, r("MapConstellation")), 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 = {
    "MapConstellation": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "factionID", js: "factionID", typ: u(undefined, 0) },
        { json: "name", js: "name", typ: r("Name") },
        { json: "position", js: "position", typ: r("Position") },
        { json: "regionID", js: "regionID", typ: 0 },
        { json: "solarSystemIDs", js: "solarSystemIDs", typ: a(0) },
        { json: "wormholeClassID", js: "wormholeClassID", typ: u(undefined, 0) },
    ], "any"),
    "Name": o([
        { json: "de", js: "de", typ: "" },
        { json: "en", js: "en", typ: "" },
        { json: "es", js: "es", typ: "" },
        { json: "fr", js: "fr", typ: "" },
        { json: "ja", js: "ja", typ: "" },
        { json: "ko", js: "ko", typ: "" },
        { json: "ru", js: "ru", typ: "" },
        { json: "zh", js: "zh", typ: "" },
    ], "any"),
    "Position": o([
        { json: "x", js: "x", typ: 3.14 },
        { json: "y", js: "y", typ: 3.14 },
        { json: "z", js: "z", typ: 3.14 },
    ], "any"),
};