ash-project / ash_json_api

The JSON:API extension for the Ash Framework
https://hexdocs.pm/ash_json_api
MIT License
55 stars 41 forks source link

Can't provide descriptions for routes at the route level #202

Open sevenseacat opened 3 weeks ago

sevenseacat commented 3 weeks ago

Is your feature request related to a problem? Please describe. When documenting API endpoints, most will pull from descriptions in the actions they call, eg.

    read :search do
      description "List Artists, optionally filtering by name."

But some endpoints need more specific documentation, eg. get routes, which would usually point at a generic read action. And some endpoints, like related/relationship endpoints, can't be documented at all?

Describe the solution you'd like A description option added for all routes, that if provided would be used in generated documentation, overriding any action-specific description.

Express the feature either with a change to resource syntax, or with a change to the resource interface

    routes do
      base_route "/artists", Tunez.Music.Artist do
        get :read, description: "Fetch an Artist record by ID."
        related :albums, :read, primary?: true, description: "Fetch all Albums released by the given Artist."
      end