document method Null safety

APISchemaObject document(
  1. APIDocumentContext context
)

Implementation

APISchemaObject document(APIDocumentContext context) {
  final schemaProperties = <String, APISchemaObject>{};
  final obj = APISchemaObject.object(schemaProperties)..title = name;

  final buffer = StringBuffer();
  if (uniquePropertySet != null) {
    final propString =
        uniquePropertySet!.map((s) => "'${s!.name}'").join(", ");
    buffer.writeln(
      "No two objects may have the same value for all of: $propString.",
    );
  }

  obj.description = buffer.toString();

  properties.forEach((name, def) {
    if (def is ManagedAttributeDescription &&
        !def.isIncludedInDefaultResultSet &&
        !def.isTransient) {
      return;
    }

    final schemaProperty = def!.documentSchemaObject(context);
    schemaProperties[name!] = schemaProperty;
  });

  return obj;
}