[Enhancement]: Configuration validator only validates layers, not mission-level fields
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 232
- Forks
- 77
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 17
Description
The validate() function in API/Backend/Config/validate.js only checks that msv, layers, and tools exist at the top level, then validates layer-specific fields (URLs, zooms, model params, etc.). It does not validate msv contents (mission name, view, radius), projection, look, time, panels, coordinates, or tools array contents. Invalid mission-level configuration can be saved via the API without any warning.
Investigation notes:
This is closely related to (and arguably a duplicate of) #329.
The root cause is in API/Backend/Config/routes/configs.js. The upsert() function has no early guard against being called with neither version nor config. When an empty config {} is passed without a version:
populateUUIDs({})is called at line 561 — beforevalidate()at line 586populateUUIDscrashes on the missinglayersproperty- The generic
.catch()at line 692 returns"Failed to find mission."— a misleading error that has nothing to do with the actual problem
The docs (docs/pages/APIs/Configure/Configure_REST_API.md line 120-124) and OpenAPI spec (docs/mmgis-openapi.json line 248-251) both mark version and config as independently optional with no mention that at least one must provide valid data.
Suggested fixes:
- Add an early guard at the top of
upsert(): if!hasVersion && (req.body.config == null || Object.keys(req.body.config).length === 0), return a clear error - Move
validate(configJSON)beforepopulateUUIDs(configJSON)so invalid configs get a proper validation error instead of crashing - Update the catch-all error at line 692 to include the actual error details, not just "Failed to find mission."
- Update docs to state: "At least one of
versionorconfigis required. If both are provided,versiontakes precedence."
From #333, #329
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read API/Backend/Config/routes/configs.js, especially upsert(), populateUUIDs(), validate(), and the catch block near line 692. Then compare the request requirements in docs/pages/APIs/Configure/Configure_REST_API.md and docs/mmgis-openapi.json. Done means invalid mission-level config receives a specific validation error, empty requests are rejected clearly, and the documented version/config requirement matches the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100