Skip to content

support in JSONEditor schema validations 'format' properties #4748

Open
@phnmn

Description

@phnmn

First Check

  • I added a very descriptive title here.
  • This is not a Q&A. I am sure something is wrong with NiceGUI or its documentation.
  • I used the GitHub search to find a similar issue and came up empty.

Example Code

from typing import Union
from uuid import UUID

from nicegui import ui
from pydantic import BaseModel, Field


class Schema(BaseModel):
    client_session_id: Union[UUID, None] = Field(default=None)


ui.json_editor(
    {
        "content": {"json": ""},
        "readOnly": True,
        "mode": "text",
    },
    schema=Schema.model_json_schema(),
)

ui.run()

Description

When the JSON schema contains format: uuid, the JSON editor fails to work and displays an error in the browser console
vue.global.prod.js:5 Error: unknown format "uuid" ignored in schema at path "#/properties/client_session_id/anyOf/0" at format.js:63:27 at format.js:50:17 at Object.code (format.js:22:13) at $ (index.js:464:13) at index.js:222:17 at e.value (index.js:439:13) at e.value (index.js:568:18) at x (index.js:219:9) at p (index.js:200:13) at index.js:192:13 (anonymous) @ vue.global.prod.js:5 content.bundle.js:55109 will try to open idb now: content
I think this can be fixed by using ajv-formats for the AJV validator.

NiceGUI Version

2.17.0

Python Version

Python 3.11.12

Browser

Chrome

Operating System

macOS

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    analysisStatus: Requires team/community inputfeatureType/scope: New feature or enhancement⚪️ minorPriority: Low impact, nice-to-have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions