Skip to content

readOnly and writeOnly with jsonschema4 doesn't work #40

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

Closed
p1c2u opened this issue Jan 29, 2022 · 0 comments
Closed

readOnly and writeOnly with jsonschema4 doesn't work #40

p1c2u opened this issue Jan 29, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@p1c2u
Copy link
Collaborator

p1c2u commented Jan 29, 2022

Given schema and validator:

schema = {
    "type": "object",
    "properties": {
        "some_prop": {
            "type": "string",
            "readOnly": True
        }
    },
    "required": ["some_prop"]
}
validator = OAS30Validator(schema, format_checker=oas30_format_checker, write=True)

For the following instance:

validator.validate({"some_prop": "hello"})

in jsonschem3 we get error (correct):

Tried to write read-only property with hello

In jsonschem4 we get no errors (incorrect)

The issue exists in all versions <0.3.0

@p1c2u p1c2u added the bug Something isn't working label Jan 29, 2022
@p1c2u p1c2u closed this as completed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant