message: Format, require ETag, fix imports
diff: @@ -174,16 +174,16 @@ registered location and you'll see your entities start to appear in Backstage.
  ## Caching processing results
  -The catalog periodically refreshes entities in the catalog, and in doing so it calls
  -out to external systems to fetch changes. This can be taxing for upstream
  +The catalog periodically refreshes entities in the catalog, and in doing so it
  +calls out to external systems to fetch changes. This can be taxing for upstream
  services and large deployments may get rate limited if too many requests are
  sent. Luckily many external systems provide ETag support to check for changes
  -which usually doesn't count towards the quota and saves resources both internally
  -and externally.
  +which usually doesn't count towards the quota and saves resources both
  +internally and externally.
  -The catalog has built in support for leveraging ETags when refreshing external locations
  -in GitHub. This example aims to demonstrate how to add the same behavior for `system-x`
  -that we implemented earlier.
  +The catalog has built in support for leveraging ETags when refreshing external
  +locations in GitHub. This example aims to demonstrate how to add the same
  +behavior for `system-x` that we implemented earlier.
  ```ts
  import { UrlReader } from '@backstage/backend-common';
  @@ -193,8 +193,8 @@ import {
  CatalogProcessor,
  CatalogProcessorEmit,
  CatalogProcessorCache,
  + CatalogProcessorParser,
  } from '@backstage/plugin-catalog-backend';
  -import { CatalogProcessorParser } from './CatalogProcessorParser';
  // It's recommended to always bump the CACHE_KEY version if you make
  // changes to the processor implementation or CacheItem.
  @@ -204,7 +204,7 @@ const CACHE_KEY = 'v1';
  // as well as the processing result used when the Etag matches.
  // Bump the CACHE_KEY version if you make any changes to this type.
  type CacheItem = {
  - etag?: string;
  + etag: string;
  entity: Entity;
  };
  @@ -244,6 +244,13 @@ export class SystemXReaderProcessor implements CatalogProcessor {
  );
  }
  + // ETag is optional in the response but we need it to cache the result.
  + if (!response.etag) {
  + throw new Error(
  + 'No ETag returned from system-x, cannot use response for caching',
  + );
  + }
  +
  // For this example the JSON payload is a single entity.
  const entity: Entity = JSON.parse(response.buffer.toString());
  emit(results.entity(location, entity));
  