Skip to content

Fix JSON validation and formatting in scene editor #92

@mosoriob

Description

@mosoriob

Problem

The 'Validate' and 'Format JSON' buttons in the scene editor (/dataset/potree//edit) are not working properly. Users cannot validate their JSON5 syntax or format their configuration files.

Current Behavior

  • Clicking 'Validate' button does not provide feedback on JSON5 syntax
  • Clicking 'Format JSON' button does not format/prettify the JSON5 content
  • No error messages or success indicators appear

Expected Behavior

  • 'Validate' button should check JSON5 syntax and show success/error messages
  • 'Format JSON' button should prettify and properly indent the JSON5 content
  • Clear user feedback should be provided for both operations

Tasks

  • Debug the JavaScript validation function in the edit template
  • Fix JSON5 parsing and validation logic
  • Ensure format function works with JSON5 syntax (comments, trailing commas)
  • Test success and error message display
  • Verify proper error handling for invalid JSON5

Files to Check

  • src/ckanext-potree/ckanext/potree/templates/potree/edit.html (lines 205-282)
  • JavaScript functions: formatBtn and validateBtn event listeners
  • JSON5 parsing logic

Acceptance Criteria

  • 'Validate' button correctly identifies valid/invalid JSON5 syntax
  • 'Format JSON' button properly formats JSON5 content with indentation
  • Clear success/error messages appear to the user
  • Functions work with JSON5 features (comments, trailing commas, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions