Skip to content

Commit

Permalink
update snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Apr 29, 2024
1 parent a5dbefd commit adcc152
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 210 deletions.
4 changes: 1 addition & 3 deletions src/generators/kotlin/KotlinGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ const SAFE_MODEL_TYPES: any[] = [
ConstrainedStringModel,
ConstrainedBooleanModel,
ConstrainedTupleModel,
ConstrainedArrayModel,
ConstrainedEnumModel,
ConstrainedUnionModel,
ConstrainedDictionaryModel
ConstrainedUnionModel
];

export class KotlinGenerator extends AbstractGenerator<
Expand Down
153 changes: 0 additions & 153 deletions src/helpers/MetaModelIterator.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports[`KotlinGenerator should render \`data class\` type 1`] = `
val time: java.time.OffsetTime? = null,
val dateTime: java.time.OffsetDateTime? = null,
val binary: ByteArray? = null,
val additionalProperties: Map<, >? = null,
val additionalProperties: Map<String, Any>? = null,
)"
`;
Expand Down Expand Up @@ -55,7 +55,7 @@ exports[`KotlinGenerator should render \`enum\` type (union type) 1`] = `
exports[`KotlinGenerator should render List type for collections 1`] = `
"data class CustomClass(
val arrayType: List<>? = null,
val arrayType: List<Int>? = null,
)"
`;
Expand All @@ -82,7 +82,7 @@ data class Address(
val members: Any? = null,
val arrayType: List<Any>,
val otherModel: OtherModel? = null,
val additionalProperties: Map<, >? = null,
val additionalProperties: Map<String, Any>? = null,
)"
`;
Expand All @@ -92,6 +92,6 @@ exports[`KotlinGenerator should render models and their dependencies 2`] = `
data class OtherModel(
val streetName: String? = null,
val additionalProperties: Map<, >? = null,
val additionalProperties: Map<String, Any>? = null,
)"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ exports[`KOTLIN_CONSTRAINTS_PRESET should render constraints annotations 1`] = `
@get:Max(99)
val maxNumberProp: Double,
@get:Size(min=2, max=3)
val arrayProp: List<>? = null,
val arrayProp: List<Any>? = null,
@get:Pattern(regexp=\\"^I_\\")
@get:Size(min=3)
val stringProp: String? = null,
val additionalProperties: Map<, >? = null,
val additionalProperties: Map<String, Any>? = null,
)"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`KOTLIN_DESCRIPTION_PRESET should render description and examples for cl
*/
data class Clazz(
val prop: String? = null,
val additionalProperties: Map<, >? = null,
val additionalProperties: Map<String, Any>? = null,
)"
`;

Expand Down
55 changes: 10 additions & 45 deletions test/generators/python/__snapshots__/PythonGenerator.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,14 @@ exports[`PythonGenerator Class should handle self reference models 1`] = `
"class Address:
def __init__(self, input: Dict):
if 'self_model' in input:
self._self_model: Address.Address = Address.Address(input['self_model'])
self._self_model: Address = Address(input['self_model'])
if 'array_model' in input:
self._array_model: List[Address.Address] = input['array_model']
self._array_model: List[Address] = input['array_model']
if 'tuple_model' in input:
self._tuple_model: tuple[Address.Address] = input['tuple_mode
self._tuple_model: tuple[Address, str] = input['tuple_model']
if 'map_model' in input:
self._map_model: dict[str, Address.Address] = input['map_model']
self._map_model: dict[str, Address] = input['map_model']
if 'union_model' in input:
self._union_model: Address.Address = input['union_model']
@property
def self_model(self) -> 'Address'.Address:
return self._self_model
@self_model.setter
def self_model(self, self_model: 'Address'.Address):
self._self_model = self_model
@property
def array_model(self) -> List['Address'.Address]:
return self._array_model
@array_model.setter
def array_model(self, array_model: List['Address'.Address]):
self._array_model = array_model
@property
def tuple_model(self) -> tuple['Address'.Address]:
return self._tuple_model
@tuple_model.setter
def tuple_model(self, tuple_model: tuple['Address'.Address]):
self._tuple_model = tuple_model
@property
def map_model(self) -> dict[str, 'Address'.Address]:
return self._map_model
@map_model.setter
def map_model(self, map_model: dict[str, 'Address'.Address]):
self._map_model = map_model
@property
def union_model(self) -> 'Address'.Address:
return self._union_model
@union_model.setter
def union_model(self, union_model: 'Address'.Address):
self._union_model: Address | str = input['union_model']
@property
Expand Down Expand Up @@ -122,24 +87,24 @@ Array [
"class CoreSchemaMetaMinusSchemaObject:
def __init__(self, input: Dict):
if 'additional_items' in input:
self._additional_items: CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool = input['additional_items']
self._additional_items: CoreSchemaMetaMinusSchemaObject | bool = input['additional_items']
if 'items' in input:
self._items: CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool | List[CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool] = input['items']
self._items: CoreSchemaMetaMinusSchemaObject | bool | List[CoreSchemaMetaMinusSchemaObject | bool] = input['items']
if 'additional_properties' in input:
self._additional_properties: dict[str, Any] = input['additional_properties']
@property
def additional_items(self) -> CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool:
def additional_items(self) -> CoreSchemaMetaMinusSchemaObject | bool:
return self._additional_items
@additional_items.setter
def additional_items(self, additional_items: CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool):
def additional_items(self, additional_items: CoreSchemaMetaMinusSchemaObject | bool):
self._additional_items = additional_items
@property
def items(self) -> CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool | List[CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool]:
def items(self) -> CoreSchemaMetaMinusSchemaObject | bool | List[CoreSchemaMetaMinusSchemaObject | bool]:
return self._items
@items.setter
def items(self, items: CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool | List[CoreSchemaMetaMinusSchemaObject.CoreSchemaMetaMinusSchemaObject | bool]):
def items(self, items: CoreSchemaMetaMinusSchemaObject | bool | List[CoreSchemaMetaMinusSchemaObject | bool]):
self._items = items
@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ exports[`PYTHON_PYDANTIC_PRESET should render pydantic for class 1`] = `
exports[`PYTHON_PYDANTIC_PRESET should render union to support Python < 3.10 1`] = `
Array [
"class UnionTest(BaseModel):
union_test: Optional[Union[Union1.Union1, Union2.Union2]] = Field(default=None, serialization_alias='unionTest')
additional_properties: Optional[dict[str, Any]] = Field(default=None, serialization_alias='additionalProperties', exclude=True)
union_test: Optional[Union[Union1.Union1, Union2.Union2]] = Field(default=None, alias='''unionTest''')
additional_properties: Optional[dict[str, Any]] = Field(exclude=True, default=None, alias='''additionalProperties''')
",
"class Union1(BaseModel):
test_prop1: Optional[str] = Field(default=None, alias='''testProp1''')
Expand Down

0 comments on commit adcc152

Please sign in to comment.