Try using "$ref": "#/" instead.

 

 

 

From: 'Toe Dipper' via Swagger <[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Wednesday, July 26, 2017 at 15:36
To: Swagger <[email protected]>
Subject: Example of self-referential (circular reference) in Swagger?

 

I'm working on defining a schema for defining hierarchical menu items.  The rub 
is that each object can have children that are the same type of object.  This 
self-referential structure is a bit tricky, however.  Does anyone have an 
example of how to do this in a swagger file? 

 

In a JSON Schema file, I can do something like this:

 

{
  "type": "object",
  "properties": {
    "href": {"type": "string"},
    "label": {"type": "string"}
    "children": {
      "type": "array",
      "items": {
         "$ref": "#"
       }
    }
  }
}

 

 

The swagger validator does not seem to like that, however.  Is this supported?  
Is there something wrong with this definition?  

Many thanks!


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 [email protected].
For more options, visit https://groups.google.com/d/optout.


-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to