GamendWeb.ApiStatsSchema (gamend_web v1.0.1216)

Copy Markdown View Source

The OpenAPI response shape shared by every /<resource>/stats endpoint.

All of them answer the same way — a flat object of integer counters under data — so the schema is built from a field list rather than restated in each controller.

Summary

Functions

A {description, "application/json", schema} ok-response for the given counter fields.

Functions

response(description, fields)

@spec response(String.t(), [atom() | {atom(), OpenApiSpex.Schema.t()}]) ::
  {String.t(), String.t(), OpenApiSpex.Schema.t()}

A {description, "application/json", schema} ok-response for the given counter fields.

Nested object fields (a by_state map, say) are declared by passing {name, %Schema{}} instead of a bare atom.