Error in Google Calendar V3 schemas: minimum/maximum returned as strings instead of numbers

14 views
Skip to first unread message

Keith Barlow

unread,
Sep 16, 2014, 2:16:48 PM9/16/14
to google-api...@googlegroups.com
Hiyas,

I am trying to use the Google Calendar V3 schema distributed in the Discovery API and having a problem digesting the schema for certain objects.  It appears that the schema is being returned with minimum and maximum values set as strings instead of numbers.  For example, on the resources->Events->watch object (id: calendar.events.watch): 

"maxAttendees": {
"type": "integer",
"description": "The maximum number of attendees to include in the response. If there are more than the specified number of attendees, only the participant is returned. Optional.",
"format": "int32",
"minimum": "1",
"location": "query"
}

But per the JSON V3 schema schema (yes, the schema for JSON V3 Schema), this field should be a number:

{
    "$schema": "http://json-schema.org/draft-03/schema#",
    "id": "http://json-schema.org/draft-03/schema#",
    "type": "object",
    
    "properties": {
        "type": {
            "type": [ "string", "array" ],
            "items": {
                "type": [ "string", { "$ref": "#" } ]
            },
            "uniqueItems": true,
            "default": "any"
        },
        
        "properties": {
            "type": "object",
            "additionalProperties": { "$ref": "#" },
            "default": {}
        },
        
        ...
        
        "minimum": {
            "type": "number"
        },
        
        "maximum": {
            "type": "number"
        },
        
        ...
        
        "id": {
            "type": "string",
            "format": "uri"
        },
        
        "$ref": {
            "type": "string",
            "format": "uri"
        },
        
        "$schema": {
            "type": "string",
            "format": "uri"
        }
    },
    
    "dependencies": {
        "exclusiveMinimum": "minimum",
        "exclusiveMaximum": "maximum"
    },
    
    "default": {}
}

It becomes a problem when using common digesters such as https://github.com/fge/json-schema-validator which are trying to check the type of the field in its default syntax checker.

Thanks.

Keith Barlow

Tony Aiuto

unread,
Sep 16, 2014, 4:53:49 PM9/16/14
to google-api...@googlegroups.com

Discovery does not promise to be json schema compliant. It is loosely based on it.

--
You received this message because you are subscribed to the Google Groups "Google APIs Discovery Service Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apis-disc...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Keith Barlow

unread,
Sep 17, 2014, 11:39:41 AM9/17/14
to google-api...@googlegroups.com
Sorry... I guess I missed the "loosely based" part in your documentation:

APIs Discovery Service uses JSON Schema draft-03 for its schema representations. 

(https://developers.google.com/discovery/v1/using#discovery-doc-resources)

Funny thing about standards: they don't work if you don't follow them.

Keith
To unsubscribe from this group and stop receiving emails from it, send an email to google-apis-discovery+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages