ApifyClient.Generator.Processor (apify_client v1.0.0)

Copy Markdown View Source

oapi_generator processor that names operations after their URL path.

Apify's operation IDs are flat (actor_runs_last_dataset_items_get) and its tags overlap (every storage endpoint is also tagged "Actor Runtime API/..."), so neither gives usable modules. Names are derived from the path instead:

  • every static segment that is a resource becomes a module segment: /v2/actors/{actorId}/runs => API.Actors.Runs

  • the function name follows the method and whether the path ends in a collection or an item:

    RequestFunction
    GET collectionlist
    POST collectioncreate
    GET item or singletonget
    PUT/PATCHupdate
    DELETEdelete
    HEADhead
  • a trailing segment with a single method that is not a resource is an action on its parent: POST /v2/actor-runs/{runId}/abort => API.Runs.abort/2

  • top-level actor-runs, actor-builds and actor-tasks become Runs, Builds and Tasks, as in the official JavaScript client (client.run(id), client.builds(), client.task(id)); the runs of one Actor stay under API.Actors.Runs

A static segment is a resource when it is top-level, has sub-paths, has more than one method, or is a collection (followed by an {id} somewhere, or a plural name with a GET). Cases the rules get wrong go into @overrides.

Operations that only duplicate another one under a different method (summaries ending in "(POST)" or "(GET)", e.g. "Update Actor version (POST)") are skipped, as are deprecated operations (ignore: [:deprecated_operations]).

Schema structs are placed under ApifyClient.Schemas.

Generation-time only

Runs under mix apify.gen only; lives in dev/ because it depends on the dev-only :oapi_generator.