OGCQueryableObject.fromJson constructor

OGCQueryableObject.fromJson(
  1. Map<String, dynamic> content
)

Parses Queryables document for an OGC API service from JSON Schema based data in content.

Implementation

factory OGCQueryableObject.fromJson(Map<String, dynamic> content) {
  if ((content['type'] as String).toLowerCase() != 'object') {
    throw const FormatException('Not valid JSON Schema type.');
  }

  final properties = content['properties'];
  return OGCQueryableObject._(
    content: content,
    id: content[r'$id'] as String, // required
    schemaId: content[r'$schema'] as String, // required
    title: content['title'] as String? ?? 'Queryables',
    description: content['description'] as String?,
    additionalProperties: content['additionalProperties'] as bool? ?? true,
    properties: properties != null && properties is Map<String, dynamic>
        ? OGCQueryableProperty._parseMap(properties)
        : <String, OGCQueryableProperty>{},
  );
}