Skip to content

Bug: date-time format not working #171

Closed
@JohannesHepp

Description

@JohannesHepp

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am having problems validating a json with a date-time format. The validator returns true for the following input:
JsonSchema

{"title":"Test","properties":{"name":{"type":"string"},"dateOfBirth":{"type":"string","format":"date-time"}}}

Json

{"name":"Test User","dateOfBirth": "test"}

Running the following code returns true and does not add any issues to the list:

val jsonSchemaValidator = JsonSchema.fromDefinition(schema)
val json = Json.encodeToJsonElement(DummySerializer(), entry)
val result = jsonSchemaValidator.validate(json, schemaValidationErrors::add)

Expected Behavior

I would expect the validator to fail on this input because the dateOfBirth property is not in the correct format.

JSON schema

{"title":"Test","properties":{"name":{"type":"string"},"dateOfBirth":{"type":"string","format":"date-time"}}}

Library version

0.2.2

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions