Skip to content
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

Bug in sub object property with required keyword #2

Closed
amazing-gao opened this issue Mar 22, 2017 · 3 comments
Closed

Bug in sub object property with required keyword #2

amazing-gao opened this issue Mar 22, 2017 · 3 comments

Comments

@amazing-gao
Copy link

Hi, i find a bug of the schema which has sub object with required property.
Such as, manage has a required field startAt and endAt, but i get the jsonschema with required properties name,internalName,startAt,endAt at the top level.
This will make validation failed to JSON-SCHEMA 4.
Do you have time to fix it?
Thanks.

// mongoose schema
{
    name: {
        type: String,
        required: true,
        unique: true,
    },
    description: {
        type: String,
    },
    internalName: {
        type: String,
        required: true,
        unique: true,
    },
    manage: {
       offline: { 
            type: Boolean,
            default: true,
        },
        startAt: {
            type: Date,
            required: true,
        },
        endAt: {
            type: Date,
            required: true,
        },
    },
}
// jsonschema
{
    "title": "book",
    "type": "object",
    "properties": {
        "name": {
            "type": "string"
        },
        "description": {
            "type": "string"
        },
        "internalName": {
            "type": "string"
        },
        "manage": {
            "title": "manage",
            "type": "object",
            "properties": {
                "offline": {
                    "type": "boolean",
                    "default": true
                },
                "startAt": {
                    "type": "string",
                    "format": "date-time"
                },
                "endAt": {
                    "type": "string",
                    "format": "date-time"
                }
            }
        }
    },
    "required": [
        "name",
        "internalName",
        "startAt",
        "endAt"
    ]
}
@DScheglov
Copy link
Owner

thank you, taking to investigation.
will back with solution soon (2017-03-25)

@DScheglov
Copy link
Owner

@amazing-gao
Copy link
Author

I have upgraded to 1.1.12 version and the bug was fixed.
I really appreciate what you have done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants