Skip to content

fix(@vue-vuetify): reuse the parent AJV - #2602

Merged
lucas-koehler merged 2 commits into
eclipsesource:masterfrom
KiaraGrouwstra:reuse-ajv
Jul 21, 2026
Merged

fix(@vue-vuetify): reuse the parent AJV#2602
lucas-koehler merged 2 commits into
eclipsesource:masterfrom
KiaraGrouwstra:reuse-ajv

Conversation

@KiaraGrouwstra

@KiaraGrouwstra KiaraGrouwstra commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Reuse the same AJV instance in @vue-vuetify.
Ensures that user configuration of AJV is retained.

Disclaimer: I used a coding agent in the creation of this patch.

@netlify

netlify Bot commented Jul 19, 2026

Copy link
Copy Markdown

Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit 758505d
🔍 Latest deploy log https://app.netlify.com/projects/jsonforms-examples/deploys/6a5f85ee8e6e91000843c1e8
😎 Deploy Preview https://deploy-preview-2602--jsonforms-examples.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@CLAassistant

CLAassistant commented Jul 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@KiaraGrouwstra
KiaraGrouwstra marked this pull request as draft July 19, 2026 12:38
@KiaraGrouwstra
KiaraGrouwstra force-pushed the reuse-ajv branch 2 times, most recently from 13b618d to 90a7ff6 Compare July 19, 2026 12:54
@KiaraGrouwstra KiaraGrouwstra changed the title fix(packages): reuse the parent AJV fix(@vue-vuetify): reuse the parent AJV Jul 19, 2026
@KiaraGrouwstra
KiaraGrouwstra marked this pull request as ready for review July 19, 2026 12:58
@coveralls

coveralls commented Jul 20, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 83.776%. remained the same — KiaraGrouwstra:reuse-ajv into eclipsesource:master

@lucas-koehler lucas-koehler 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.

Hi @KiaraGrouwstra ,
thank you very much for contributing to JSON Forms ❤️
I had a look at the change and I don't think it makes a difference:
useJsonForms() of the vue package already injects the JSON Forms core state. Its ajv property should be the same ajv as injected by useAjv(). See useAjvs code here:

export function useAjv(): Ajv;
export function useAjv(optional: true): Ajv | undefined;
export function useAjv(optional?: true) {
const jsonforms = optional === true ? useJsonForms(true) : useJsonForms();
if (!optional && (!jsonforms?.core || !jsonforms.core.ajv)) {
throw new Error(
"'jsonforms ajv' couldn't be injected. Are you within JSON Forms?"
);
}
return jsonforms?.core?.ajv as Ajv;
}

Am I missing something that makes this change necessary?

@KiaraGrouwstra
KiaraGrouwstra force-pushed the reuse-ajv branch 2 times, most recently from 7b6d39b to f734784 Compare July 20, 2026 09:38
@KiaraGrouwstra

Copy link
Copy Markdown
Contributor Author

Hi @lucas-koehler, thanks for your response!
I added a test demonstrating the underlying issue now.

import { extendedVuetifyRenderers } from '../../../src';

global.ResizeObserver = require('resize-observer-polyfill');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This duplicates the vuetify + ResizeObserver bootstrap from tests/unit/util/util.ts. mountJsonForms doesn't take an ajv yet, so extending it with an optional param would let this test reuse the shared helper instead of re-rolling the setup.

@lucas-koehler

Copy link
Copy Markdown
Contributor

@KiaraGrouwstra Sorry for the confusion, I mislooked what excatly useJsonForms returns vs. how ajv is attempted to be extracted from that. Using useAjv instead of course makes sense 👍

KiaraGrouwstra and others added 2 commits July 21, 2026 16:44
…m's AJV

Assisted-by: Claude:claude-opus-4-8

Signed-off-by: Kiara Grouwstra <kiara.grouwstra@gmail.com>
Reuse the same AJV instance throughout JSONForms.
Ensures that user configuration of AJV is retained.

Signed-off-by: Kiara Grouwstra <kiara.grouwstra@gmail.com>

@lucas-koehler lucas-koehler 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.

LGTM now! Thanks for the contribution ❤️

@lucas-koehler lucas-koehler added this to the 3.9 milestone Jul 21, 2026
@lucas-koehler
lucas-koehler merged commit 32faf9a into eclipsesource:master Jul 21, 2026
10 of 11 checks passed
@KiaraGrouwstra
KiaraGrouwstra deleted the reuse-ajv branch July 21, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants