[DEV-9353] Support $optionalRef syntax JsonFileSourceProcessor - #19
Merged
Conversation
facetoe
force-pushed
the
DEV-9353-zconf-optional-refs
branch
from
July 2, 2026 22:08
655b041 to
c54fc06
Compare
facetoe
marked this pull request as ready for review
July 2, 2026 22:08
facetoe
commented
Jul 2, 2026
facetoe
commented
Jul 2, 2026
facetoe
commented
Jul 2, 2026
RabidGhost
requested changes
Jul 3, 2026
RabidGhost
left a comment
There was a problem hiding this comment.
Overall looks good. Just some changes to test clarity, and to resolve as many issues as possible before reporting problems.
facetoe
force-pushed
the
DEV-9353-zconf-optional-refs
branch
from
July 3, 2026 04:56
c54fc06 to
d7aa76a
Compare
RabidGhost
approved these changes
Jul 3, 2026
Add support for $optionalRef, inspired by JSONSchema ref. It is
$optionalRef and not $ref as the JSONSchema spec requires that the
referenced file exist or the parser should fail, so invented this
version to keep the semantics clear. We also only support file:// refs.
The basic idea is that you can add a reference like so:
{
"metricsDatabase": {
"$optionalRef": "file:///home/coe/worktmp/test.json"
}
}
And provided the destination path exists, the entire entry (including
$optionalRef key) will be replaced with what is in the destination. In
the event that the destination is absent, the entire containing object
is removed (ie, no metricsDatabase key in structure anymore).
The idea here is that we can optionally mount things in Kubernets, such
as DB secrets, config etc, and then reference it using this feature. In
the event it exists, the application is configured to use the config. If
it is absent, the config is removed. The result is a type of dynamic
configuration based on what has been injected into the environment.
Signed-off-by: William Coe <william.coe@zepben.com>
facetoe
force-pushed
the
DEV-9353-zconf-optional-refs
branch
from
July 6, 2026 01:07
d7aa76a to
e009355
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for $optionalRef, inspired by JSONSchema ref. It is $optionalRef and not $ref as the JSONSchema spec requires that the referenced file exist or the parser should fail, so invented this version to keep the semantics clear. We also only support file:// refs.
The basic idea is that you can add a reference like so:
And provided the destination path exists, the entire entry (including $optionalRef key) will be replaced with what is in the destination. In the event that the destination is absent, the entire containing object is removed (ie, no metricsDatabase key in structure anymore).
The idea here is that we can optionally mount things in Kubernets, such as DB secrets, config etc, and then reference it using this feature. In the event it exists, the application is configured to use the config. If it is absent, the config is removed. The result is a type of dynamic configuration based on what has been injected into the environment.
Description
See commit message.
Associated tasks
NA
Test Steps
Wrote tests
Checklist
Code
Security
When developing applications, use following guidelines for information security considerations:
Documentation
Breaking Changes
Please leave a summary of the breaking changes here and then post it on the Slack breaking-changes channel to notify the team about it.