pdb-schema-extract

command
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

pdb-schema-extract parses PeeringDB's Django serializer and model Python source into an intermediate JSON schema describing all 13 PeeringDB object types: the scalar wire fields (derived from DRF serializer introspection), their FK references, and computed-field names.

Role: this is a DRIFT DETECTOR, not the schema source of truth. The committed schema/peeringdb.json is hand-curated (help_text becomes ent .Comment(), the name uniqueness is deliberately relaxed, info_types is curated to a list, etc.), and pdb-schema-generate consumes that curation. Use this tool to diff a fresh upstream checkout against the committed schema and surface genuine field-level drift (adds/removes/type/ref/required/nullable changes); apply any real drift to the curated schema by hand. Do NOT overwrite schema/peeringdb.json with this tool's raw output — it would regress the curation.

Known limitations (acceptable for drift detection): custom DRF field classes that are not serializers.<X> constructors (e.g. LegacyInfoTypeField) are not recognised, and some abstract-base inheritance for org/fac is incompletely resolved, so those types under-report fields. Cross-check unexpected removals against upstream source before treating them as real.

Usage:

pdb-schema-extract <peeringdb-repo-path> [--validate]

The repo path should point at the src/ root of a local peeringdb/peeringdb checkout. The tool expects to find:

  • {repo}/peeringdb_server/serializers.py
  • {repo}/peeringdb_server/models.py
  • {repo}/../django-peeringdb/src/django_peeringdb/models/abstract.py
  • {repo}/../django-peeringdb/src/django_peeringdb/const.py

When --validate is passed, the tool also fetches sample data from beta.peeringdb.com and compares response field names against extracted schema fields, reporting mismatches.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL