Swagger does not like included JSON Schema object because of "$schema" and "id" properties

38 views
Skip to first unread message

Toe Dipper

unread,
Jun 14, 2017, 3:42:10 PM6/14/17
to Swagger
From my understanding of JSON Schema, a schema document can (and should) include a parameter for the version of its schema and an id that uniquely identifies the definition, e.g.

{
   
"$schema": "http://json-schema.org/draft-04/schema#",
   
"id": "mydef",
   
"type": "object",
   
"title": "My Schema Definition",
   
"description": "A bit more info here...",
   
"properties": {}
}

However, if I include such a schema inside of a Swagger document, an error is generated:

Schema error at definitions.mydef

additionalProperty "$schema" exists in when not allowed

There is a similar error for including the "id" parameter.  Is this error correct?  Are my JSON Schema definitions invalid if they include "$schema" (see https://spacetelescope.github.io/understanding-json-schema/reference/schema.html)?  Or is this a limitation of Swagger only implementing a subset of the JSON Schema spec?

Thanks for any clarifications!

tony tam

unread,
Jun 14, 2017, 3:43:30 PM6/14/17
to swagger-sw...@googlegroups.com
Please check out the specification to see what subset of JSON schema is supported:


The spec does not support the JSON schema draft 4 100%.

Please NOTE: This electronic message, including any attachments, may include privileged, confidential and/or inside information owned by Leaf Group. Any distribution or use of this communication by anyone other than the intended recipient(s) is strictly prohibited and may be unlawful. If you are not the intended recipient, please notify the sender by replying to this message and then delete it from your system. Thank you.

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

Toe Dipper

unread,
Jun 15, 2017, 2:26:21 PM6/15/17
to Swagger
Thanks for your response.  I know there's a pinned post re v3 of the specification, but is there a draft available to look at?  I'm very curious as to whether Swagger will fully support the JSON Schema spec in the future.  That limitation alone could be the deciding factor between Swagger and RAML for some projects.

tony tam

unread,
Jun 15, 2017, 2:44:23 PM6/15/17
to swagger-sw...@googlegroups.com
It’s not full Json Schema but close.  Please see below for the draft spec (and please note that Mulesoft has joined the OAI, which is the Swagger Specification under the Linux Foundation)



On Jun 15, 2017, at 11:26 AM, 'Toe Dipper' via Swagger <swagger-sw...@googlegroups.com> wrote:

Thanks for your response.  I know there's a pinned post re v3 of the specification, but is there a draft available to look at?  I'm very curious as to whether Swagger will fully support the JSON Schema spec in the future.  That limitation alone could be the deciding factor between Swagger and RAML for some projects.

Reply all
Reply to author
Forward
0 new messages