Skip to content

EVE SDE Schema

Documentation for third-party developers

cloneGrades.jsonl

Schema

  • _key (required): integer
    Range: 1 .. 8
  • name (required): string
  • skills (required): array of object
    • level (required): integer
      Range: 1 .. 5
    • typeID (required): integer
      Range: 3300 .. 91017

Code snippets

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

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

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

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

        [JsonProperty("name")]
        [JsonConverter(typeof(MinMaxLengthCheckConverter))]
        public string Name { get; set; }

        [JsonProperty("skills")]
        public Skill[] Skills { get; set; }
    }

    public partial class Skill
    {
        [JsonProperty("level")]
        public long Level { get; set; }

        [JsonProperty("typeID")]
        public long TypeId { get; set; }
    }

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

    public static class Serialize
    {
        public static string ToJson(this CloneGrade 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 MinMaxLengthCheckConverter : 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 >= 11 && value.Length <= 14)
            {
                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 >= 11 && value.Length <= 14)
            {
                serializer.Serialize(writer, value);
                return;
            }
            throw new Exception("Cannot marshal type string");
        }

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

package model

import "encoding/json"

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

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

type CloneGrade struct {
    Key    int64   `json:"_key"`
    Name   string  `json:"name"`
    Skills []Skill `json:"skills"`
}

type Skill struct {
    Level  int64 `json:"level"`
    TypeID int64 `json:"typeID"`
}
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"_key":{"type":"integer","minimum":1,"maximum":8},"name":{"type":"string","minLength":11,"maxLength":14},"skills":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":5},"typeID":{"type":"integer","minimum":3300,"maximum":91017}},"required":["level","typeID"]},"minItems":175,"maxItems":175}},"required":["_key","name","skills"]}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json       = Json { allowStructuredMapKeys = true }
// val cloneGrade = json.parse(CloneGrade.serializer(), jsonString)

package model

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

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

    val name: String,
    val skills: List<Skill>
)

@Serializable
data class Skill (
    val level: Long,

    @SerialName("typeID")
    val typeId: Long
)
<?php

// This is a autogenerated file:CloneGrade

class CloneGrade {
    private int $key; // json:_key Required
    private string $name; // json:name Required
    private array $skills; // json:skills Required

    /**
     * @param int $key
     * @param string $name
     * @param array $skills
     */
    public function __construct(int $key, string $name, array $skills) {
        $this->key = $key;
        $this->name = $name;
        $this->skills = $skills;
    }

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

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

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

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

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

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

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

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

    /**
     * @return string
     */
    public static function sampleName(): string {
        return 'CloneGrade::name::32'; /*32:name*/
    }

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

    /**
     * @throws Exception
     * @return array
     */
    public function toSkills(): array {
        if (CloneGrade::validateSkills($this->skills))  {
            return array_map(function ($value) {
                return $value->to(); /*class*/
            }, $this->skills);
        }
        throw new Exception('never get to this CloneGrade::skills');
    }

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

    /**
     * @throws Exception
     * @return array
     */
    public function getSkills(): array {
        if (CloneGrade::validateSkills($this->skills))  {
            return $this->skills;
        }
        throw new Exception('never get to getSkills CloneGrade::skills');
    }

    /**
     * @return array
     */
    public static function sampleSkills(): array {
        return  array(
            Skill::sample() /*33:*/
        ); /* 33:skills*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return CloneGrade::validateKey($this->key)
        || CloneGrade::validateName($this->name)
        || CloneGrade::validateSkills($this->skills);
    }

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

    /**
     * @param stdClass $obj
     * @return CloneGrade
     * @throws Exception
     */
    public static function from(stdClass $obj): CloneGrade {
        return new CloneGrade(
         CloneGrade::fromKey($obj->{'_key'})
        ,CloneGrade::fromName($obj->{'name'})
        ,CloneGrade::fromSkills($obj->{'skills'})
        );
    }

    /**
     * @return CloneGrade
     */
    public static function sample(): CloneGrade {
        return new CloneGrade(
         CloneGrade::sampleKey()
        ,CloneGrade::sampleName()
        ,CloneGrade::sampleSkills()
        );
    }
}

// This is a autogenerated file:Skill

class Skill {
    private int $level; // json:level Required
    private int $typeId; // json:typeID Required

    /**
     * @param int $level
     * @param int $typeId
     */
    public function __construct(int $level, int $typeId) {
        $this->level = $level;
        $this->typeId = $typeId;
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function toLevel(): int {
        if (Skill::validateLevel($this->level))  {
            return $this->level; /*int*/
        }
        throw new Exception('never get to this Skill::level');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getLevel(): int {
        if (Skill::validateLevel($this->level))  {
            return $this->level;
        }
        throw new Exception('never get to getLevel Skill::level');
    }

    /**
     * @return int
     */
    public static function sampleLevel(): int {
        return 31; /*31:level*/
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function toTypeId(): int {
        if (Skill::validateTypeId($this->typeId))  {
            return $this->typeId; /*int*/
        }
        throw new Exception('never get to this Skill::typeId');
    }

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

    /**
     * @throws Exception
     * @return int
     */
    public function getTypeId(): int {
        if (Skill::validateTypeId($this->typeId))  {
            return $this->typeId;
        }
        throw new Exception('never get to getTypeId Skill::typeId');
    }

    /**
     * @return int
     */
    public static function sampleTypeId(): int {
        return 32; /*32:typeId*/
    }

    /**
     * @throws Exception
     * @return bool
     */
    public function validate(): bool {
        return Skill::validateLevel($this->level)
        || Skill::validateTypeId($this->typeId);
    }

    /**
     * @return stdClass
     * @throws Exception
     */
    public function to(): stdClass  {
        $out = new stdClass();
        $out->{'level'} = $this->toLevel();
        $out->{'typeID'} = $this->toTypeId();
        return $out;
    }

    /**
     * @param stdClass $obj
     * @return Skill
     * @throws Exception
     */
    public static function from(stdClass $obj): Skill {
        return new Skill(
         Skill::fromLevel($obj->{'level'})
        ,Skill::fromTypeId($obj->{'typeID'})
        );
    }

    /**
     * @return Skill
     */
    public static function sample(): Skill {
        return new Skill(
         Skill::sampleLevel()
        ,Skill::sampleTypeId()
        );
    }
}
from typing import Any, List, 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_str(x: Any) -> str:
    assert isinstance(x, str)
    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()


class Skill:
    level: int
    type_id: int

    def __init__(self, level: int, type_id: int) -> None:
        self.level = level
        self.type_id = type_id

    @staticmethod
    def from_dict(obj: Any) -> 'Skill':
        assert isinstance(obj, dict)
        level = from_int(obj.get("level"))
        type_id = from_int(obj.get("typeID"))
        return Skill(level, type_id)

    def to_dict(self) -> dict:
        result: dict = {}
        result["level"] = from_int(self.level)
        result["typeID"] = from_int(self.type_id)
        return result


class CloneGrade:
    key: int
    name: str
    skills: List[Skill]

    def __init__(self, key: int, name: str, skills: List[Skill]) -> None:
        self.key = key
        self.name = name
        self.skills = skills

    @staticmethod
    def from_dict(obj: Any) -> 'CloneGrade':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        name = from_str(obj.get("name"))
        skills = from_list(Skill.from_dict, obj.get("skills"))
        return CloneGrade(key, name, skills)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        result["name"] = from_str(self.name)
        result["skills"] = from_list(lambda x: to_class(Skill, x), self.skills)
        return result


def clone_grade_from_dict(s: Any) -> CloneGrade:
    return CloneGrade.from_dict(s)


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

export interface CloneGrade {
    _key:   number;
    name:   string;
    skills: Skill[];
    [property: string]: any;
}

export interface Skill {
    level:  number;
    typeID: 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 toCloneGrade(json: string): CloneGrade {
        return cast(JSON.parse(json), r("CloneGrade"));
    }

    public static cloneGradeToJson(value: CloneGrade): string {
        return JSON.stringify(uncast(value, r("CloneGrade")), 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 = {
    "CloneGrade": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "name", js: "name", typ: "" },
        { json: "skills", js: "skills", typ: a(r("Skill")) },
    ], "any"),
    "Skill": o([
        { json: "level", js: "level", typ: 0 },
        { json: "typeID", js: "typeID", typ: 0 },
    ], "any"),
};