Skip to content

[Fixes #14651] Management command for metadata validation - #14653

Open
etj wants to merge 1 commit into
masterfrom
14651_metadata_validation
Open

etj wants to merge 1 commit into
masterfrom
14651_metadata_validation

Conversation

@etj

@etj etj commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

For all pull requests:

  • Confirm you have read the contribution guidelines
  • You have sent a Contribution Licence Agreement (CLA) as necessary (not required for small changes, e.g., fixing typos in the documentation)
  • Make sure the first PR targets the master branch, eventual backports will be managed later. This can be ignored if the PR is fixing an issue that only happens in a specific branch, but not in newer ones.

The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):

  • There is a ticket in https://github.com/GeoNode/geonode/issues describing the issue/improvement/feature (a notable exemption is, changes not visible to end-users)
  • The issue connected to the PR must have Labels and Milestone assigned
  • PR for bug fixes and small new features are presented as a single commit
  • PR title must be in the form "[Fixes #<issue_number>] Title of the PR"
  • New unit tests have been added covering the changes, unless there is an explanation on why the tests are not necessary/implemented

Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.

Copilot AI lite review requested due to automatic review settings September 24, 2026 16:05
@cla-bot cla-bot Bot added the cla-signed CLA Bot: community license agreement signed label Sep 24, 2026
@etj etj self-assigned this Sep 24, 2026
@etj
etj requested a review from mattiagiupponi September 24, 2026 16:05
@etj etj linked an issue Sep 24, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved correctness, performance, error-handling, and test-coverage issues remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)
What changed in this PR

Adds a Django management command for validating GeoNode resource metadata against JSON Schema and generating reports.

Changes:

  • Supports resource filtering, language selection, and validation options.
  • Generates JSON or CSV validation reports.
  • Reports schema and instance validation errors.
File Summary
geonode/​metadata/​management/​commands/​validate_metadata.py Implements metadata validation, filtering, error formatting, and reporting.
geonode/​metadata/​management/​commands/​__init__.py Reviewed; no functional changes noted.
geonode/​metadata/​management/​__init__.py Reviewed; no functional changes noted.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return json.loads(json.dumps(data, cls=JSONEncoder))

def select_resources(self, ids, resource_types):
queryset = ResourceBase.objects.all()
if not record["valid"]:
invalid_count += 1
if not record["valid"] or options["include_valid"]:
records.append(record)
Comment on lines +232 to +234
errors = self.drop_redundant(validator.iter_errors(instance))
errors = sorted(errors, key=lambda err: ([str(p) for p in err.absolute_path], str(err.validator)))
reported = errors[:max_errors] if max_errors > 0 else errors

parser.add_argument("--debug", dest="debug", action="store_true", help="Set log level to debug")

def handle(self, *args, **options):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 5.1.x cla-signed CLA Bot: community license agreement signed enhancement metadata

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Management command for metadata validation

2 participants