From 9c5f09703b6a8fa5ff0961857f7507148a987975 Mon Sep 17 00:00:00 2001 From: Christoph Kappestein Date: Sun, 27 Oct 2024 12:28:53 +0100 Subject: [PATCH] update test --- .../resource/csharp/complex/TypeSchema.cs | 18 +++++ .../resource/go/complex/type_schema.go | 8 +++ .../resource/java/complex/TypeSchema.java | 43 +++++++++++ .../resource/kotlin/complex/TypeSchema.kt | 9 +++ .../resource/php/complex/TypeSchema.php | 71 +++++++++++++++++++ .../resource/python/complex/type_schema.py | 14 ++++ .../resource/ruby/complex/type_schema.rb | 12 ++++ .../resource/rust/complex/type_schema.rs | 17 +++++ .../resource/swift/complex/TypeSchema.swift | 13 ++++ .../resource/typescript/complex/TypeSchema.ts | 11 +++ .../visualbasic/complex/TypeSchema.vb | 15 ++++ 11 files changed, 231 insertions(+) create mode 100644 tests/Generator/resource/csharp/complex/TypeSchema.cs create mode 100644 tests/Generator/resource/go/complex/type_schema.go create mode 100644 tests/Generator/resource/java/complex/TypeSchema.java create mode 100644 tests/Generator/resource/kotlin/complex/TypeSchema.kt create mode 100644 tests/Generator/resource/php/complex/TypeSchema.php create mode 100644 tests/Generator/resource/python/complex/type_schema.py create mode 100644 tests/Generator/resource/ruby/complex/type_schema.rb create mode 100644 tests/Generator/resource/rust/complex/type_schema.rs create mode 100644 tests/Generator/resource/swift/complex/TypeSchema.swift create mode 100644 tests/Generator/resource/typescript/complex/TypeSchema.ts create mode 100644 tests/Generator/resource/visualbasic/complex/TypeSchema.vb diff --git a/tests/Generator/resource/csharp/complex/TypeSchema.cs b/tests/Generator/resource/csharp/complex/TypeSchema.cs new file mode 100644 index 0000000..2572b45 --- /dev/null +++ b/tests/Generator/resource/csharp/complex/TypeSchema.cs @@ -0,0 +1,18 @@ +using System.Text.Json.Serialization; + +/// +/// TypeSchema specification +/// +public class TypeSchema +{ + [JsonPropertyName("import")] + public System.Collections.Generic.Dictionary? Import { get; set; } + + [JsonPropertyName("definitions")] + public System.Collections.Generic.Dictionary? Definitions { get; set; } + + [JsonPropertyName("root")] + public string? Root { get; set; } + +} + diff --git a/tests/Generator/resource/go/complex/type_schema.go b/tests/Generator/resource/go/complex/type_schema.go new file mode 100644 index 0000000..4d89045 --- /dev/null +++ b/tests/Generator/resource/go/complex/type_schema.go @@ -0,0 +1,8 @@ + +// TypeSchema specification +type TypeSchema struct { + Import map[string]string `json:"import"` + Definitions map[string]DefinitionType `json:"definitions"` + Root string `json:"root"` +} + diff --git a/tests/Generator/resource/java/complex/TypeSchema.java b/tests/Generator/resource/java/complex/TypeSchema.java new file mode 100644 index 0000000..7e633d7 --- /dev/null +++ b/tests/Generator/resource/java/complex/TypeSchema.java @@ -0,0 +1,43 @@ + +import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonSetter; + +/** + * TypeSchema specification + */ +public class TypeSchema { + private java.util.Map _import; + private java.util.Map definitions; + private String root; + + @JsonSetter("import") + public void setImport(java.util.Map _import) { + this._import = _import; + } + + @JsonGetter("import") + public java.util.Map getImport() { + return this._import; + } + + @JsonSetter("definitions") + public void setDefinitions(java.util.Map definitions) { + this.definitions = definitions; + } + + @JsonGetter("definitions") + public java.util.Map getDefinitions() { + return this.definitions; + } + + @JsonSetter("root") + public void setRoot(String root) { + this.root = root; + } + + @JsonGetter("root") + public String getRoot() { + return this.root; + } +} + diff --git a/tests/Generator/resource/kotlin/complex/TypeSchema.kt b/tests/Generator/resource/kotlin/complex/TypeSchema.kt new file mode 100644 index 0000000..afb712f --- /dev/null +++ b/tests/Generator/resource/kotlin/complex/TypeSchema.kt @@ -0,0 +1,9 @@ +/** + * TypeSchema specification + */ +open class TypeSchema { + @JsonProperty("import") var import: Map? = null + @JsonProperty("definitions") var definitions: Map? = null + @JsonProperty("root") var root: String? = null +} + diff --git a/tests/Generator/resource/php/complex/TypeSchema.php b/tests/Generator/resource/php/complex/TypeSchema.php new file mode 100644 index 0000000..6273b34 --- /dev/null +++ b/tests/Generator/resource/php/complex/TypeSchema.php @@ -0,0 +1,71 @@ +|null + */ + #[Description('Through the import keyword it is possible to import other TypeSchema documents. It contains a map where the key is the namespace and the value points to a remote document. The value is a URL and a code generator should support at least the following schemes: file, http, https.')] + protected ?\PSX\Record\Record $import = null; + /** + * @var \PSX\Record\Record|null + */ + protected ?\PSX\Record\Record $definitions = null; + #[Description('Specifies the root type of your specification.')] + protected ?string $root = null; + /** + * @param \PSX\Record\Record|null $import + */ + public function setImport(?\PSX\Record\Record $import) : void + { + $this->import = $import; + } + /** + * @return \PSX\Record\Record|null + */ + public function getImport() : ?\PSX\Record\Record + { + return $this->import; + } + /** + * @param \PSX\Record\Record|null $definitions + */ + public function setDefinitions(?\PSX\Record\Record $definitions) : void + { + $this->definitions = $definitions; + } + /** + * @return \PSX\Record\Record|null + */ + public function getDefinitions() : ?\PSX\Record\Record + { + return $this->definitions; + } + public function setRoot(?string $root) : void + { + $this->root = $root; + } + public function getRoot() : ?string + { + return $this->root; + } + public function toRecord() : \PSX\Record\RecordInterface + { + /** @var \PSX\Record\Record $record */ + $record = new \PSX\Record\Record(); + $record->put('import', $this->import); + $record->put('definitions', $this->definitions); + $record->put('root', $this->root); + return $record; + } + public function jsonSerialize() : object + { + return (object) $this->toRecord()->getAll(); + } +} + diff --git a/tests/Generator/resource/python/complex/type_schema.py b/tests/Generator/resource/python/complex/type_schema.py new file mode 100644 index 0000000..581c868 --- /dev/null +++ b/tests/Generator/resource/python/complex/type_schema.py @@ -0,0 +1,14 @@ +from pydantic import BaseModel, Field, GetCoreSchemaHandler +from pydantic_core import CoreSchema, core_schema +from typing import Any, Dict, Generic, List, Optional, TypeVar, UserList, UserDict +from .definition_type import DefinitionType + + +# TypeSchema specification +class TypeSchema(BaseModel): + import_: Optional[Dict[str, str]] = Field(default=None, alias="import") + definitions: Optional[Dict[str, DefinitionType]] = Field(default=None, alias="definitions") + root: Optional[str] = Field(default=None, alias="root") + pass + + diff --git a/tests/Generator/resource/ruby/complex/type_schema.rb b/tests/Generator/resource/ruby/complex/type_schema.rb new file mode 100644 index 0000000..4506ef9 --- /dev/null +++ b/tests/Generator/resource/ruby/complex/type_schema.rb @@ -0,0 +1,12 @@ + +# TypeSchema specification +class TypeSchema + attr_accessor :import, :definitions, :root + + def initialize(import, definitions, root) + @import = import + @definitions = definitions + @root = root + end +end + diff --git a/tests/Generator/resource/rust/complex/type_schema.rs b/tests/Generator/resource/rust/complex/type_schema.rs new file mode 100644 index 0000000..02cc28c --- /dev/null +++ b/tests/Generator/resource/rust/complex/type_schema.rs @@ -0,0 +1,17 @@ +use serde::{Serialize, Deserialize}; +use definition_type::DefinitionType; + +// TypeSchema specification +#[derive(Serialize, Deserialize)] +pub struct TypeSchema { + #[serde(rename = "import")] + import: Option>, + + #[serde(rename = "definitions")] + definitions: Option>, + + #[serde(rename = "root")] + root: Option, + +} + diff --git a/tests/Generator/resource/swift/complex/TypeSchema.swift b/tests/Generator/resource/swift/complex/TypeSchema.swift new file mode 100644 index 0000000..5b4e7e3 --- /dev/null +++ b/tests/Generator/resource/swift/complex/TypeSchema.swift @@ -0,0 +1,13 @@ +// TypeSchema specification +class TypeSchema: Codable { + var _import: Dictionary + var definitions: Dictionary + var root: String + + enum CodingKeys: String, CodingKey { + case _import = "import" + case definitions = "definitions" + case root = "root" + } +} + diff --git a/tests/Generator/resource/typescript/complex/TypeSchema.ts b/tests/Generator/resource/typescript/complex/TypeSchema.ts new file mode 100644 index 0000000..cb7d21c --- /dev/null +++ b/tests/Generator/resource/typescript/complex/TypeSchema.ts @@ -0,0 +1,11 @@ +import {DefinitionType} from "./DefinitionType"; + +/** + * TypeSchema specification + */ +export interface TypeSchema { + import?: Map + definitions?: Map + root?: string +} + diff --git a/tests/Generator/resource/visualbasic/complex/TypeSchema.vb b/tests/Generator/resource/visualbasic/complex/TypeSchema.vb new file mode 100644 index 0000000..3d75200 --- /dev/null +++ b/tests/Generator/resource/visualbasic/complex/TypeSchema.vb @@ -0,0 +1,15 @@ +Imports System.Text.Json.Serialization + +' TypeSchema specification +Public Class TypeSchema + + Public Property Import As Dictionary(Of String, String) + + + Public Property Definitions As Dictionary(Of String, DefinitionType) + + + Public Property Root As String + +End Class +