Skip to content

EVE SDE Schema

Documentation for third-party developers

dogmaAttributeCategories.jsonl

Schema

  • _key (required): integer
    Range: 1 .. 52
  • description: string
  • name (required): string

Code snippets

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

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

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

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

        [JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(PurpleMinMaxLengthCheckConverter))]
        public string Description { get; set; }

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

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

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

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

package model

import "encoding/json"

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

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

type DogmaAttributeCategory struct {
    Key         int64   `json:"_key"`
    Description *string `json:"description,omitempty"`
    Name        string  `json:"name"`
}
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
        "_key": {
            "type": "integer",
            "minimum": 1,
            "maximum": 52
        },
        "description": {
            "type": "string",
            "minLength": 7,
            "maxLength": 56
        },
        "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 39
        }
    },
    "required": [
        "_key",
        "name"
    ]
}
// To parse the JSON, install kotlin's serialization plugin and do:
//
// val json                   = Json { allowStructuredMapKeys = true }
// val dogmaAttributeCategory = json.parse(DogmaAttributeCategory.serializer(), jsonString)

package model

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

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

    val description: String? = null,
    val name: String
)
<?php

// This is a autogenerated file:DogmaAttributeCategory

class DogmaAttributeCategory {
    private int $key; // json:_key Required
    private ?string $description; // json:description Optional
    private string $name; // json:name Required

    /**
     * @param int $key
     * @param string|null $description
     * @param string $name
     */
    public function __construct(int $key, ?string $description, string $name) {
        $this->key = $key;
        $this->description = $description;
        $this->name = $name;
    }

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

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

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

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

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

    /**
     * @throws Exception
     * @return ?string
     */
    public function toDescription(): ?string {
        if (DogmaAttributeCategory::validateDescription($this->description))  {
            if (!is_null($this->description)) {
                return $this->description; /*string*/
            } else {
                return  null;
            }
        }
        throw new Exception('never get to this DogmaAttributeCategory::description');
    }

    /**
     * @param string|null
     * @return bool
     * @throws Exception
     */
    public static function validateDescription(?string $value): bool {
        if (!is_null($value)) {
            if (!is_string($value)) {
                throw new Exception("Attribute Error:DogmaAttributeCategory::description");
            }
        }
        return true;
    }

    /**
     * @throws Exception
     * @return ?string
     */
    public function getDescription(): ?string {
        if (DogmaAttributeCategory::validateDescription($this->description))  {
            return $this->description;
        }
        throw new Exception('never get to getDescription DogmaAttributeCategory::description');
    }

    /**
     * @return ?string
     */
    public static function sampleDescription(): ?string {
        return 'DogmaAttributeCategory::description::32'; /*32:description*/
    }

    /**
     * @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 (DogmaAttributeCategory::validateName($this->name))  {
            return $this->name; /*string*/
        }
        throw new Exception('never get to this DogmaAttributeCategory::name');
    }

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

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

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

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

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

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

    /**
     * @return DogmaAttributeCategory
     */
    public static function sample(): DogmaAttributeCategory {
        return new DogmaAttributeCategory(
         DogmaAttributeCategory::sampleKey()
        ,DogmaAttributeCategory::sampleDescription()
        ,DogmaAttributeCategory::sampleName()
        );
    }
}
from typing import Optional, Any, TypeVar, 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_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 to_class(c: Type[T], x: Any) -> dict:
    assert isinstance(x, c)
    return cast(Any, x).to_dict()


class DogmaAttributeCategory:
    key: int
    description: Optional[str]
    name: str

    def __init__(self, key: int, description: Optional[str], name: str) -> None:
        self.key = key
        self.description = description
        self.name = name

    @staticmethod
    def from_dict(obj: Any) -> 'DogmaAttributeCategory':
        assert isinstance(obj, dict)
        key = from_int(obj.get("_key"))
        description = from_union([from_str, from_none], obj.get("description"))
        name = from_str(obj.get("name"))
        return DogmaAttributeCategory(key, description, name)

    def to_dict(self) -> dict:
        result: dict = {}
        result["_key"] = from_int(self.key)
        if self.description is not None:
            result["description"] = from_union([from_str, from_none], self.description)
        result["name"] = from_str(self.name)
        return result


def dogma_attribute_category_from_dict(s: Any) -> DogmaAttributeCategory:
    return DogmaAttributeCategory.from_dict(s)


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

export interface DogmaAttributeCategory {
    _key:         number;
    description?: string;
    name:         string;
    [property: string]: any;
}

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

    public static dogmaAttributeCategoryToJson(value: DogmaAttributeCategory): string {
        return JSON.stringify(uncast(value, r("DogmaAttributeCategory")), 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 = {
    "DogmaAttributeCategory": o([
        { json: "_key", js: "_key", typ: 0 },
        { json: "description", js: "description", typ: u(undefined, "") },
        { json: "name", js: "name", typ: "" },
    ], "any"),
};