# AJV issues with slashes in JSON Pointer

**URL:** <https://jsonforms.discourse.group/t/ajv-issues-with-slashes-in-json-pointer/1418>\
**Category:** General\
**Created:** [April 3, 2023, 7:45am UTC](https://jsonforms.discourse.group/t/ajv-issues-with-slashes-in-json-pointer/1418 "2023-04-03T07:45:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamsilva01](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@adamsilva01](https://jsonforms.discourse.group/u/adamsilva01)\
**Post date:** [April 3, 2023, 7:45am UTC](https://jsonforms.discourse.group/t/ajv-issues-with-slashes-in-json-pointer/1418/1 "2023-04-03T07:45:35Z")

</div>

My schema properties keys are JSON Pointers that contain forward slashes `/`. This posed an issue early on when I needed to create a custom UISchema, but eventually I found the `encode` function from JSON Forms, and used that to encode the keys when creating the UI Schema.

However, I’m now using AJV to validate form errors and this doesn’t seem to be updating correctly. For example, if I have an email schema with the email format and it’s required, only the required error will be catched. No matter what I write in the field, the email error doesn’t show. And I’ve verified that if I remove all forward slashes from the property name in the schema, this starts to works properly.

When checking the VueDevtools, I can see the required error if there is nothing written, but if I write something that is not an email, I don’t see the format email error. Maybe something is not being updated correctly due to the forward slashes.

Here is the schema I use:

```auto
{
"/personal/email": {
      "title": "Email with slash",
      "description": "Email address With Slash",
      "type": "string",
      "format": "email"
    },
}

```

Just in case, here is the custom renderer I use to display string controls:

```auto
<template>
    <v-text-field v-model="control.data"
                  :placeholder="control.label"
                  :error="Boolean(control.errors)"
                  :error-messages="control.errors"
                  @change="onChange" />
</template>

<script lang="ts">
import { ControlElement, JsonFormsRendererRegistryEntry, rankWith, isStringControl } from '@jsonforms/core'
import { useJsonFormsControl, RendererProps, rendererProps } from '@jsonforms/vue'
import { defineComponent } from 'vue'
import { useVanillaControl } from '@jsonforms/vue-vanilla'

const applyFormRenderText = defineComponent({
    name: 'apply-form-render-text',
    props: {
        ...rendererProps<ControlElement>(),
    },
    setup (props: RendererProps<ControlElement>) {
        return useVanillaControl(useJsonFormsControl(props), target => target.value || undefined)
    },
})

export default applyFormRenderText

export const entry: JsonFormsRendererRegistryEntry = {
    renderer: applyFormRenderText,
    tester: rankWith(2, isStringControl),
}
</script>

```

And here is how I’m initiating JSON Forms:

```auto
<template>
    <json-forms :data="data" 
                :renderers="renderers"
                :schema="schema"
                :uischema="uischema" 
                :ajv="customAjv"
                @change="onChange" />
</template>
<script setup>
import { createAjv } from '@jsonforms/core'
import { vanillaRenderers } from '@jsonforms/vue-vanilla'
const customAjv = createAjv()

const renderers: JsonFormsRendererRegistryEntry[] = markRaw([
    applyFormRenderText,
    ...vanillaRenderers,
])
</setup>

```

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [April 4, 2023, 8:42am UTC](https://jsonforms.discourse.group/t/ajv-issues-with-slashes-in-json-pointer/1418/2 "2023-04-04T08:42:05Z")

</div>

Hi @adamsilva01,

We’ll have a look. If it’s a mapping problem then the error should be somewhere [here](https://github.com/eclipsesource/jsonforms/blob/229d99a9a8a79a95549b2eae2a11037a5515997f/packages/core/src/reducers/core.ts#L377) in case you want to debug yourself.

---

<div class="post-metadata">

**Author:** ![adamsilva01](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@adamsilva01](https://jsonforms.discourse.group/u/adamsilva01)\
**Post date:** [April 4, 2023, 11:12am UTC](https://jsonforms.discourse.group/t/ajv-issues-with-slashes-in-json-pointer/1418/3 "2023-04-04T11:12:38Z")

</div>

Hey @sdirix ,

I’ve been trying to debug that, but I’m having some issues doing the first time setup for jsonforms.  
I’ll try to do what I can in the meantime to try and debug this, and I look forward to any solution for this.

Thanks

---

<div class="post-metadata">

**Author:** ![adamsilva01](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@adamsilva01](https://jsonforms.discourse.group/u/adamsilva01)\
**Post date:** [April 10, 2023, 9:47am UTC](https://jsonforms.discourse.group/t/ajv-issues-with-slashes-in-json-pointer/1418/4 "2023-04-10T09:47:41Z")

</div>

Hey @sdirix ,

I’ve had to put this on hold for a bit. Did you manage to have any luck in debugging this?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![adamsilva01](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@adamsilva01](https://jsonforms.discourse.group/u/adamsilva01)\
**Post date:** [June 13, 2023, 9:13am UTC](https://jsonforms.discourse.group/t/ajv-issues-with-slashes-in-json-pointer/1418/5 "2023-06-13T09:13:46Z")

</div>

Hey @sdirix ,

Did you manage to have a look at this?  
I’d rather like to avoid having to convert both ways all fields to acceptable formats.

Thanks!

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [June 13, 2023, 10:55am UTC](https://jsonforms.discourse.group/t/ajv-issues-with-slashes-in-json-pointer/1418/6 "2023-06-13T10:55:15Z")

</div>

Hi @adamsilva01,

I took a look at the issue. As expected, the issue occurred during error matching. I created [a PR](https://github.com/eclipsesource/jsonforms/pull/2147) to fix the issue. Once merged the fix will be part of the next (pre)release.
