toJson method

Map<String, Object> toJson()

Converts a CustomResourceDefinitionSpec instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempConversion = conversion;
  final tempGroup = group;
  final tempNames = names;
  final tempPreserveUnknownFields = preserveUnknownFields;
  final tempScope = scope;
  final tempVersions = versions;

  if (tempConversion != null) {
    jsonData['conversion'] = tempConversion.toJson();
  }

  jsonData['group'] = tempGroup;

  jsonData['names'] = tempNames.toJson();

  if (tempPreserveUnknownFields != null) {
    jsonData['preserveUnknownFields'] = tempPreserveUnknownFields;
  }

  jsonData['scope'] = tempScope;

  jsonData['versions'] =
      tempVersions.map((e) => e.toJson()).toList(growable: false);

  return jsonData;
}