Open
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- AjvService currently creates a new Ajv2019 instance in each consumer; if per-form isolation is not required, consider exposing a shared singleton instance from the service to avoid repeated setup cost and configuration duplication.
- AjvService.cleanupSchema and deleteDynamicDefaults operate on
any; consider introducing a JSON Schema type (or at least a narrower interface) for theschemaparameter to catch structural issues at compile time. - In PublishComponent you removed the explicit
metadata = cloneDeep(publishedDataConfig.defaultValues)assignment; if the form should still start with backend-provided defaults, consider reintroducing this initialization alongside AJVuseDefaultshandling to preserve existing behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- AjvService currently creates a new Ajv2019 instance in each consumer; if per-form isolation is not required, consider exposing a shared singleton instance from the service to avoid repeated setup cost and configuration duplication.
- AjvService.cleanupSchema and deleteDynamicDefaults operate on `any`; consider introducing a JSON Schema type (or at least a narrower interface) for the `schema` parameter to catch structural issues at compile time.
- In PublishComponent you removed the explicit `metadata = cloneDeep(publishedDataConfig.defaultValues)` assignment; if the form should still start with backend-provided defaults, consider reintroducing this initialization alongside AJV `useDefaults` handling to preserve existing behavior.
## Individual Comments
### Comment 1
<location path="src/app/datasets/publish/publish.component.ts" line_range="136" />
<code_context>
+ publishedDataConfig.metadataSchema,
+ );
this.uiSchema = publishedDataConfig.uiSchema;
- this.metadata = cloneDeep(publishedDataConfig.defaultValues) ?? {};
}
},
</code_context>
<issue_to_address>
**question (bug_risk):** Removing `metadata` initialization may change how defaults are applied.
`metadata` used to be initialized from `publishedDataConfig.defaultValues`, but now it relies solely on Ajv defaults (`useDefaults: "empty"`). If `defaultValues` was meant to override or extend schema defaults, this will change the initial form state. Please confirm this behavior change is intended and that `defaultValues` is no longer required here.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
minottic
reviewed
Apr 10, 2026
Member
minottic
left a comment
There was a problem hiding this comment.
LGTM, but plz consider addressing the sourcery comments
119d088 to
fba5f88
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.
Description
Use a custom ajv instance for publisheddata metadata editing
Motivation
dynamicDefaultsfunctions as only they are only registered by the backend)Changes:
Tests included
Documentation
official documentation info
If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included
Backend version
Summary by Sourcery
Introduce a shared AJV 2019 service and wire it into metadata publish/edit forms to support schema defaults and modern JSON Schema features while filtering unsupported keywords.
New Features:
Enhancements:
Build:
Tests: