documentComponents method

  1. @override
void documentComponents(
  1. APIDocumentContext context

Tells this object to add its components to context.

You may register components with context in this method. The order in which components are registered does not matter.


    class Car implements APIComponentDocumenter {
      void documentComponents(APIDocumentContext context) {
        context.schema.register("Car", APISchemaObject.object({
          "make": APISchemaObject.string(),
          "model": APISchemaObject.string(),
          "year": APISchemaObject.integer(),

See APIDocumentContext for more details.


void documentComponents(APIDocumentContext context) {
  final obj = document(context);
  context.schema.register(name, obj, representation: instanceType!);