JSON References are a bit tricky – if you want to reference something that has 
a slash in it, you need to escape it because slashes are the path separator.

To escape it, you need to use ~1.

 

In your example below:

 

$ref: '#/paths/~1store~1order' 

 

That’s assuming I didn’t make a mistake myself.

 

 

 

 

From: <swagger-swaggersocket@googlegroups.com> on behalf of spmcfarland 
<mcfarland.step...@gmail.com>
Reply-To: "swagger-swaggersocket@googlegroups.com" 
<swagger-swaggersocket@googlegroups.com>
Date: Tuesday, 16 May 2017 at 10:29
To: Swagger <swagger-swaggersocket@googlegroups.com>
Subject: Swagger editor path references; error: could not resolve reference

 

Hi,

I am using the swagger editor, hosted by swaggerhub, and writing swagger 2.0 
yaml.

I would like to have one path, be a reference to another path.  e.g. in the 
Swagger Petstore example 

 

/store/inventory:
$ref: '#/paths/store/order' 

  /store/order:  

    post:  .... 

  # not a great example, but it exercises the concept...

 

Which, I read should be valid syntax per this stack overflow posting...

http://stackoverflow.com/questions/34503533/two-paths-for-the-same-method

 

Unfortunately, the hosted editor throws an error: could not resolve reference

 

Researching in this group it looks like there is a suggesting to use domains; 
however, referencing out to a domain seems overkill in this instance, and I was 
trying to keep it simple and in the same file.

Is there an issue with the hosted editor parsing, or is the solution to use 
domains?

Thanks!
Steve

-- 
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-swaggersocket+unsubscr...@googlegroups.com.
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 swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to