Skip to content

support in JSONEditor schema validations 'format' properties #4748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
phnmn opened this issue May 15, 2025 · 1 comment · May be fixed by #4749
Open
3 tasks done

support in JSONEditor schema validations 'format' properties #4748

phnmn opened this issue May 15, 2025 · 1 comment · May be fixed by #4749
Labels
analysis Status: Requires team/community input feature Type/scope: New feature or enhancement ⚪️ minor Priority: Low impact, nice-to-have

Comments

@phnmn
Copy link

phnmn commented May 15, 2025

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

@evnchn evnchn linked a pull request May 15, 2025 that will close this issue
1 task
@evnchn evnchn added feature Type/scope: New feature or enhancement ⚪️ minor Priority: Low impact, nice-to-have labels May 15, 2025
@evnchn
Copy link
Collaborator

evnchn commented May 15, 2025

@phnmn Kindly check out #4749. You can early-enjoy the benefits of that PR if you edit the source code of your local NiceGUI install (best if you do this in a virtual environment like venv or Docker so that you don't mess up your global NiceGUI installation)

@falkoschindler falkoschindler added the analysis Status: Requires team/community input label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis Status: Requires team/community input feature Type/scope: New feature or enhancement ⚪️ minor Priority: Low impact, nice-to-have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants