Files
divkit/api_generator/tests/references/reference_resolve_references.json
T
grechka62 87ac4287b9 Fix list of expressions generating
Fix list of expressions generating

Add generator tests for arrays
2022-10-11 13:50:41 +03:00

1033 lines
27 KiB
JSON

{
"test_schema": [
{
"common.json": {
"non_empty_string": {
"type": "string",
"minLength": 1,
"clientMinLength": 1
},
"color": {
"type": "string",
"format": "color"
},
"url": {
"type": "string",
"format": "uri"
},
"positive_integer": {
"type": "integer",
"constraint": "number > 0"
},
"non_negative_integer": {
"type": "integer",
"constraint": "number >= 0"
},
"boolean_int": {
"type": "integer",
"enum": [
0,
1
],
"format": "boolean"
}
}
},
{
"entity.json": {
"anyOf": [
{
"$resolved_refs": [
"entity_with_array.json"
],
"type": "$defined_entity_with_array"
},
{
"$resolved_refs": [
"entity_with_array_of_enums.json"
],
"type": "$defined_entity_with_array_of_enums"
},
{
"$resolved_refs": [
"entity_with_array_of_expressions.json"
],
"type": "$defined_entity_with_array_of_expressions"
},
{
"$resolved_refs": [
"entity_with_array_of_nested_items.json"
],
"type": "$defined_entity_with_array_of_nested_items"
},
{
"$resolved_refs": [
"entity_with_array_with_transform.json"
],
"type": "$defined_entity_with_array_with_transform"
},
{
"$resolved_refs": [
"entity_with_complex_property.json"
],
"type": "$defined_entity_with_complex_property"
},
{
"$resolved_refs": [
"entity_with_complex_property_with_default_value.json"
],
"type": "$defined_entity_with_complex_property_with_default_value"
},
{
"$resolved_refs": [
"entity_with_entity_property.json"
],
"type": "$defined_entity_with_entity_property"
},
{
"$resolved_refs": [
"entity_with_optional_complex_property.json"
],
"type": "$defined_entity_with_optional_complex_property"
},
{
"$resolved_refs": [
"entity_with_optional_property.json"
],
"type": "$defined_entity_with_optional_property"
},
{
"$resolved_refs": [
"entity_with_optional_string_enum_property.json"
],
"type": "$defined_entity_with_optional_string_enum_property"
},
{
"$resolved_refs": [
"entity_with_property_with_default_value.json"
],
"type": "$defined_entity_with_property_with_default_value"
},
{
"$resolved_refs": [
"entity_with_required_property.json"
],
"type": "$defined_entity_with_required_property"
},
{
"$resolved_refs": [
"entity_with_simple_properties.json"
],
"type": "$defined_entity_with_simple_properties"
},
{
"$resolved_refs": [
"entity_with_strict_array.json"
],
"type": "$defined_entity_with_strict_array"
},
{
"$resolved_refs": [
"entity_with_string_array_property.json"
],
"type": "$defined_entity_with_string_array_property"
},
{
"$resolved_refs": [
"entity_with_string_enum_property.json"
],
"type": "$defined_entity_with_string_enum_property"
},
{
"$resolved_refs": [
"entity_with_string_enum_property_with_default_value.json"
],
"type": "$defined_entity_with_string_enum_property_with_default_value"
},
{
"$resolved_refs": [
"entity_without_properties.json"
],
"type": "$defined_entity_without_properties"
}
]
}
},
{
"entity_with_array.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_array"
]
},
"array": {
"type": "array",
"items": {
"$resolved_refs": [
"entity.json"
],
"type": "$defined_entity"
},
"minItems": 1,
"clientMinItems": 1
}
},
"required": [
"type",
"array"
]
}
},
{
"entity_with_array_of_enums.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_array_of_enums"
]
},
"items": {
"type": "array",
"items": {
"type": "string",
"enum": [
"first",
"second"
]
},
"minItems": 1,
"clientMinItems": 1
}
},
"required": [
"type",
"items"
]
}
},
{
"entity_with_array_of_expressions.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_array_of_expressions"
]
},
"items": {
"type": "array",
"items": {
"$resolved_refs": [
"common.json#/non_empty_string"
],
"type": "string",
"minLength": 1,
"clientMinLength": 1
},
"minItems": 1,
"clientMinItems": 1
}
},
"required": [
"type",
"items"
]
}
},
{
"entity_with_array_of_nested_items.json": {
"type": "object",
"definitions": {
"item": {
"type": "object",
"properties": {
"property": {
"$resolved_refs": [
"common.json#/non_empty_string"
],
"type": "string",
"minLength": 1,
"clientMinLength": 1
},
"entity": {
"$resolved_refs": [
"entity.json"
],
"type": "$defined_entity"
}
},
"required": [
"property",
"entity"
]
}
},
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_array_of_nested_items"
]
},
"items": {
"type": "array",
"items": {
"$resolved_refs": [
"#/definitions/item"
],
"type": "object",
"properties": {
"property": {
"$resolved_refs": [
"common.json#/non_empty_string"
],
"type": "string",
"minLength": 1,
"clientMinLength": 1
},
"entity": {
"$resolved_refs": [
"entity.json"
],
"type": "$defined_entity"
}
},
"required": [
"property",
"entity"
],
"$typename": "item"
},
"minItems": 1,
"clientMinItems": 1
}
},
"required": [
"type",
"items"
]
}
},
{
"entity_with_array_with_transform.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_array_with_transform"
]
},
"array": {
"type": "array",
"items": {
"$resolved_refs": [
"common.json#/color"
],
"type": "string",
"format": "color"
},
"minItems": 1,
"clientMinItems": 1
}
},
"required": [
"type",
"array"
]
}
},
{
"entity_with_complex_property.json": {
"type": "object",
"definitions": {
"complex_property": {
"type": "object",
"properties": {
"value": {
"$resolved_refs": [
"common.json#/url"
],
"type": "string",
"format": "uri"
}
},
"required": [
"value"
]
}
},
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_complex_property"
]
},
"property": {
"$resolved_refs": [
"#/definitions/complex_property"
],
"type": "object",
"properties": {
"value": {
"$resolved_refs": [
"common.json#/url"
],
"type": "string",
"format": "uri"
}
},
"required": [
"value"
],
"$typename": "complex_property"
}
},
"required": [
"type",
"property"
]
}
},
{
"entity_with_complex_property_with_default_value.json": {
"type": "object",
"definitions": {
"complex_property": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"required": [
"value"
]
}
},
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_complex_property_with_default_value"
]
},
"property": {
"default_value": "{ \"value\": \"Default text\" }",
"$resolved_refs": [
"#/definitions/complex_property"
],
"type": "object",
"properties": {
"value": {
"type": "string"
}
},
"required": [
"value"
],
"$typename": "complex_property"
}
},
"required": [
"type"
]
}
},
{
"entity_with_entity_property.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_entity_property"
]
},
"entity": {
"default_value": "{ \"type\": \"entity_with_string_enum_property\", \"property\": \"second\" }",
"$resolved_refs": [
"entity.json"
],
"type": "$defined_entity"
}
},
"required": [
"type"
]
}
},
{
"entity_with_optional_complex_property.json": {
"type": "object",
"definitions": {
"complex_property": {
"type": "object",
"properties": {
"value": {
"$resolved_refs": [
"common.json#/url"
],
"type": "string",
"format": "uri"
}
},
"required": [
"value"
]
}
},
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_optional_complex_property"
]
},
"property": {
"$resolved_refs": [
"#/definitions/complex_property"
],
"type": "object",
"properties": {
"value": {
"$resolved_refs": [
"common.json#/url"
],
"type": "string",
"format": "uri"
}
},
"required": [
"value"
],
"$typename": "complex_property"
}
},
"required": [
"type"
]
}
},
{
"entity_with_optional_property.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_optional_property"
]
},
"property": {
"$resolved_refs": [
"common.json#/non_empty_string"
],
"type": "string",
"minLength": 1,
"clientMinLength": 1
}
},
"required": [
"type"
]
}
},
{
"entity_with_optional_string_enum_property.json": {
"type": "object",
"definitions": {
"string_enum_property": {
"type": "string",
"enum": [
"first",
"second"
]
}
},
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_optional_string_enum_property"
]
},
"property": {
"$resolved_refs": [
"#/definitions/string_enum_property"
],
"type": "string",
"enum": [
"first",
"second"
],
"$typename": "string_enum_property"
}
},
"required": [
"type"
]
}
},
{
"entity_with_required_property.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_required_property"
]
},
"property": {
"$resolved_refs": [
"common.json#/non_empty_string"
],
"type": "string",
"minLength": 1,
"clientMinLength": 1
}
},
"required": [
"type",
"property"
]
}
},
{
"entity_with_strict_array.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_strict_array"
]
},
"array": {
"type": "array",
"items": {
"$resolved_refs": [
"entity.json"
],
"type": "$defined_entity"
},
"minItems": 1,
"clientMinItems": 1,
"strictParsing": true
}
},
"required": [
"type",
"array"
]
}
},
{
"entity_with_string_array_property.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_string_array_property"
]
},
"array": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"clientMinItems": 1
}
},
"required": [
"type",
"array"
]
}
},
{
"entity_with_string_enum_property.json": {
"type": "object",
"definitions": {
"string_enum_property": {
"type": "string",
"enum": [
"first",
"second"
]
}
},
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_string_enum_property"
]
},
"property": {
"$resolved_refs": [
"#/definitions/string_enum_property"
],
"type": "string",
"enum": [
"first",
"second"
],
"$typename": "string_enum_property"
}
},
"required": [
"type",
"property"
]
}
},
{
"entity_with_string_enum_property_with_default_value.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_string_enum_property_with_default_value"
]
},
"value": {
"type": "string",
"enum": [
"first",
"second",
"third"
],
"default_value": "second"
}
},
"required": [
"type"
]
}
},
{
"entity_without_properties.json": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_without_properties"
]
}
},
"required": [
"type"
]
}
},
{
"entity_with_property_with_default_value.json": {
"type": "object",
"definitions": {
"int_prop": {
"default_value": "0",
"$resolved_refs": [
"common.json#/non_negative_integer"
],
"type": "integer",
"constraint": "number >= 0"
},
"url_prop": {
"schemes": [
"https"
],
"default_value": "https://yandex.ru",
"$resolved_refs": [
"common.json#/url"
],
"type": "string",
"format": "uri"
},
"nested": {
"type": "object",
"properties": {
"int": {
"$resolved_refs": [
"#/definitions/int_prop",
"common.json#/non_negative_integer"
],
"default_value": "0",
"type": "integer",
"constraint": "number >= 0"
},
"url": {
"$resolved_refs": [
"#/definitions/url_prop",
"common.json#/url"
],
"schemes": [
"https"
],
"default_value": "https://yandex.ru",
"type": "string",
"format": "uri"
},
"non_optional": {
"type": "string"
}
},
"required": [
"non_optional"
],
"description_translations": {
"en": "non_optional is used to suppress auto-generation of default value for object with all-optional fields.",
"ru": "non_optional используется, чтобы запретить автогенерацию дефолтного значения для объекта, все свойства которого опциональны."
}
}
},
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_property_with_default_value"
]
},
"int": {
"$resolved_refs": [
"#/definitions/int_prop",
"common.json#/non_negative_integer"
],
"default_value": "0",
"type": "integer",
"constraint": "number >= 0"
},
"url": {
"$resolved_refs": [
"#/definitions/url_prop",
"common.json#/url"
],
"schemes": [
"https"
],
"default_value": "https://yandex.ru",
"type": "string",
"format": "uri"
},
"nested": {
"$resolved_refs": [
"#/definitions/nested"
],
"type": "object",
"properties": {
"int": {
"$resolved_refs": [
"#/definitions/int_prop",
"common.json#/non_negative_integer"
],
"default_value": "0",
"type": "integer",
"constraint": "number >= 0",
"$typename": "int_prop"
},
"url": {
"$resolved_refs": [
"#/definitions/url_prop",
"common.json#/url"
],
"schemes": [
"https"
],
"default_value": "https://yandex.ru",
"type": "string",
"format": "uri",
"$typename": "url_prop"
},
"non_optional": {
"type": "string"
}
},
"required": [
"non_optional"
],
"$typename": "nested",
"description_translations": {
"en": "non_optional is used to suppress auto-generation of default value for object with all-optional fields.",
"ru": "non_optional используется, чтобы запретить автогенерацию дефолтного значения для объекта, все свойства которого опциональны."
}
}
},
"required": [
"type"
]
}
},
{
"entity_with_simple_properties.json": {
"type": "object",
"swift_protocols": "EntityProtocol",
"properties": {
"type": {
"type": "string",
"enum": [
"entity_with_simple_properties"
]
},
"id": {
"type": "integer",
"supports_expressions": false,
"description_translations": {
"en": "ID. Can't contain expressions.",
"ru": "Идентификатор. Не может содержать выражение."
}
},
"string": {
"platforms": [
"android",
"ios",
"web"
],
"description_translations": {
"en": "String.",
"ru": "Строка."
},
"$resolved_refs": [
"common.json#/non_empty_string"
],
"type": "string",
"minLength": 1,
"clientMinLength": 1
},
"integer": {
"type": "integer",
"description_translations": {
"en": "Integer.",
"ru": "Целое число."
}
},
"double": {
"type": "number",
"description_translations": {
"en": "Floating point number.",
"ru": "Число с плавающей точкой."
}
},
"boolean": {
"type": "boolean",
"description_translations": {
"en": "Boolean property.",
"ru": "Логическое значение."
}
},
"boolean_int": {
"deprecated": true,
"platforms": [
"android"
],
"description_translations": {
"en": "Boolean value in numeric format.",
"ru": "Логическое значение в числовом формате."
},
"$resolved_refs": [
"common.json#/boolean_int"
],
"type": "integer",
"enum": [
0,
1
],
"format": "boolean"
},
"positive_integer": {
"platforms": [],
"description_translations": {
"en": "Positive integer.",
"ru": "Положительное целое число."
},
"$resolved_refs": [
"common.json#/positive_integer"
],
"type": "integer",
"constraint": "number > 0"
},
"color": {
"description_translations": {
"en": "Color.",
"ru": "Цвет."
},
"$resolved_refs": [
"common.json#/color"
],
"type": "string",
"format": "color"
},
"url": {
"$resolved_refs": [
"common.json#/url"
],
"type": "string",
"format": "uri"
}
},
"required": [
"type"
],
"description_translations": {
"en": "Entity with simple properties.",
"ru": "Объект с простыми свойствами."
}
}
},
{
"translations.json": {
"entity_with_property_with_default_value_nested": {
"en": "non_optional is used to suppress auto-generation of default value for object with all-optional fields.",
"ru": "non_optional используется, чтобы запретить автогенерацию дефолтного значения для объекта, все свойства которого опциональны."
},
"entity_with_simple_properties": {
"en": "Entity with simple properties.",
"ru": "Объект с простыми свойствами."
},
"entity_with_simple_properties_id": {
"en": "ID. Can't contain expressions.",
"ru": "Идентификатор. Не может содержать выражение."
},
"entity_with_simple_properties_string": {
"en": "String.",
"ru": "Строка."
},
"entity_with_simple_properties_integer": {
"en": "Integer.",
"ru": "Целое число."
},
"entity_with_simple_properties_double": {
"en": "Floating point number.",
"ru": "Число с плавающей точкой."
},
"entity_with_simple_properties_boolean": {
"en": "Boolean property.",
"ru": "Логическое значение."
},
"entity_with_simple_properties_boolean_int": {
"en": "Boolean value in numeric format.",
"ru": "Логическое значение в числовом формате."
},
"entity_with_simple_properties_positive_integer": {
"en": "Positive integer.",
"ru": "Положительное целое число."
},
"entity_with_simple_properties_color": {
"en": "Color.",
"ru": "Цвет."
}
}
}
]
}