Skip to content

Design API v3 #14540

Description

@etj

Why

v2 has two problems a patch can't fix without breaking existing clients:

  • It's built on django-dynamic-rest, whose automatic joins and sideloading (include[]/filter{}) are hard to predict from the serializer alone, and page size is uncapped.
  • It has no OpenAPI schema, so nothing documents an endpoint automatically.

What

v3 is a clean break, not a v2 migration. Decisions made:

  • Plain DRF — ModelSerializer + explicit select_related/prefetch_related, no dynamic-rest.
  • A single ?fields= parameter replaces DREST's include[]/exclude[]/ filter{}/sort[], and prunes the query as well as the response.
  • Trailing slash is required on every v3 path — one canonical URL per endpoint.
  • Every v3 viewset must declare permission_classes explicitly; REST_FRAMEWORK has no project-wide default, so an omission means world-writable.
  • OpenAPI via drf-spectacular, scoped to v3 only. It was dropped from GeoNode entirely once before because it conflicted with dynamic-rest; safe to bring back now that v3 doesn't use it.
  • File layout follows v2's own per-app convention, one version segment deeper: shared infrastructure at geonode/api/v3/, each resource under its owning app's api/v3/. v2 itself is not touched or renamed.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions