datacontract/datacontract-cli

Can't import valid jsonschema

Plozano94 opened this issue · 4 comments

Hi there,
I'm just starting to test the tool and found tha I couldn't import a basic json schema.

Reproduce:
Create jsonschemafile.json with
{ "$id": "https://example.com/person.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Person", "type": "object", "properties": { "firstName": { "type": "string", "description": "The person's first name." }, "lastName": { "type": "string", "description": "The person's last name." }, "age": { "description": "Age in years which must be equal to or greater than zero.", "type": "integer", "minimum": 0 } } }
and then
datacontract import --format jsonschema --source jsonschemafile.json

Error:
imagen

Confirming this bug, when the description field on top level is missing.

Workaround: Define a description field

{
    "$id": "https://example.com/person.schema.json",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "Person",
    "type": "object",
    "description": "Some description",
    "properties": {
        "firstName": {
            "type": "string",
            "description": "The person's first name."
        },
        "lastName": {
            "type": "string",
            "description": "The person's last name."
        },
        "age": {
            "description": "Age in years which must be equal to or greater than zero.",
            "type": "integer",
            "minimum": 0
        }
    }
}

Fix is scheduled for v0.10.9

Thank you!

v0.10.9 has been released