SchemaObject.fromOpenApi constructor
SchemaObject.fromOpenApi({})
Implementation
factory SchemaObject.fromOpenApi({
required APISchemaObject object,
required String name,
bool required = false,
bool isRoot = true,
}) {
return SchemaObject(
name: name,
required: required,
typeName: getTypeNameFromSchemaObject(object, name),
fields: object.properties?.entries
.map(
(property) => SchemaObject.fromOpenApi(
name: property.key,
object: property.value!,
required: object.required?.contains(property.key) ?? false,
),
)
.toList(),
isArray: object.type == APIType.array,
isObject: object.type == APIType.object,
description: object.description,
itemsType: object.items != null
? SchemaObject.fromOpenApi(
object: object.items!,
name: 'e',
isRoot: false,
required: true,
)
: null,
isRoot: isRoot,
);
}