Swagger Editor external reference local file vrs. remote

604 views
Skip to first unread message

Gregg Fiehler

unread,
Dec 1, 2017, 12:44:31 PM12/1/17
to Swagger
I have swagger editor running locally.  With Ron's help I got a local file for an external reference to work

fragment of swagger doc:
responses:
        200:
          description: An array of products
          schema:
            type: array
            items:
              $ref: 'ReservationEventDefinitions.json#/definitions/PostalAddress'


I then put the same file in Amazon S3 and I cannot get it to work

  i only updated the $ref line to

$ref: 'https://s3.amazonaws.com/st-swagger-docs/ReservationEventDefinitions.json#/definitions/PostalAddress'

and I get
Swagger Error

Reference could not be resolved: https://s3.amazonaws.com/st-swagger-docs/ReservationEventDefinitions.json#/definitions/PostalAddress


however when I look at the network traffic, both calls work. I have attached the screen print of the editor with the error when using the remote reference, the local one works fine.  So I assume there is a syntax issue on how I am doing the remote reference.  Any help would be appreciated.


Gregg


Auto Generated Inline Image 1

Ron Ratovsky

unread,
Dec 1, 2017, 1:29:57 PM12/1/17
to swagger-sw...@googlegroups.com

Hi Gregg,

 

That’s an old version of the editor which we don’t support anymore.

Please try the latest version.

--
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.

Gregg Fiehler

unread,
Dec 1, 2017, 2:13:38 PM12/1/17
to Swagger
Ok I installed the latest and then had to change the local file ref to

$ref: 'http://localhost:8080/ReservationEventDefinitions.json#/definitions/PostalAddress'

now that works, but the remote still does not

Errors

Resolver error at paths./products.get.responses.200.schema.items.$ref

Could not resolve reference because of: NetworkError when attempting to fetch resource.


but the network traffic still shows it as a 200

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Auto Generated Inline Image 1

Ron Ratovsky

unread,
Dec 1, 2017, 2:58:37 PM12/1/17
to swagger-sw...@googlegroups.com

It looks like the access to the file hosted on S3 is restricted, so the editor can’t read it. You’d need to enable anonymous access to it.

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.

--

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.

Gregg Fiehler

unread,
Dec 1, 2017, 3:17:07 PM12/1/17
to Swagger
I don't think that is the issue, the network monitor in the browser shows the call returned the data with a 200 response code and the response is identical to when I use the local file.  Also I can just cut/paste the url in the $ref in the browser and get the document.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@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+unsub...@googlegroups.com.

Gregg Fiehler

unread,
Dec 1, 2017, 3:37:34 PM12/1/17
to Swagger
BTW their is a restriction on the S3 URL to only allow it to work inside our firewall so you would not be able to access it for a test.

Ron Ratovsky

unread,
Dec 1, 2017, 4:03:46 PM12/1/17
to swagger-sw...@googlegroups.com

That would make it difficult for me to figure out what’s wrong…

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.

--
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.

--
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.

Gregg Fiehler

unread,
Dec 1, 2017, 5:53:58 PM12/1/17
to Swagger
ok I switched the file out to something I can share and gave public access

both
$ref: 'https://s3.amazonaws.com/st-swagger-docs/testschema.json/testschema.json#/definitions/PostalAddress'
$ref: 'https://s3.amazonaws.com/st-swagger-docs/testschema.json/testschema.json#/definitions/PostalAddress'

fail with same error as before, but both work if I just cut and paste into browser

 $ref: 'http://localhost:8080/testschema.json#/definitions/PostalAddress'

the local ref still works fine.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@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+unsub...@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+unsub...@googlegroups.com.

Ron Ratovsky

unread,
Dec 4, 2017, 6:18:44 PM12/4/17
to swagger-sw...@googlegroups.com

I still can’t access those…


https://lh6.googleusercontent.com/proxy/v6quYz_GlKwMhelsUIJF370-hFCrxpSlqufPHFg69K2EXSRv7u4WNbl8v4wVKOtzLFK88gV6GiBCYyCIelqaI1o7_N_V5SGiYhfQVwunGhzTje40MqmvzuFE5nCn8V7wYJV9mGbdj41-4bXTYEuIffGSFuGRpNCYhUsW3NQ3=w5000-h5000

https://lh5.googleusercontent.com/proxy/HFmYTZS0aHoUHxrayFB6sQGKuwqt3sD2_QhH9dy7pslm4LRQXjf2LTSRU9GH8bg_U9KWLDgNlu0sCQ5-5sz8FGLykV9254V-dWoRD47AvZZCZEERyURIr64LQt-qU575SFlOxh94n5WwhE8nq6nPUBQpVoKO7whi_TotKU6H=w5000-h5000

--
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.

--
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.

--
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.

--
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.

Gregg Fiehler

unread,
Dec 5, 2017, 11:14:31 AM12/5/17
to Swagger
Hi Ron, I do apologize, I had set it up on Friday to give public read only access and someone changed it back over the weekend.  I just fixed it so it should work now.  Again sorry for the inconvenience.

Gregg

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@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+unsub...@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+unsub...@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+unsub...@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Dec 5, 2017, 11:35:00 AM12/5/17
to swagger-sw...@googlegroups.com

I’m afraid it still doesn’t work for me…

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.

--
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.

--
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.

--
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.

--
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.

Gregg Fiehler

unread,
Dec 5, 2017, 12:02:07 PM12/5/17
to Swagger
try this 

https://s3.amazonaws.com/st-swagger-docs/testschema.json#/definitions/PostalAddress

I had a typo in the URL I sent before, but that is not what is in my swagger document so I am unsure how I messed that up.

Ron Ratovsky

unread,
Dec 5, 2017, 12:34:21 PM12/5/17
to swagger-sw...@googlegroups.com

Thanks, that worked.

 

It looks like it’s a CORS issue. If you check the console, you’ll see something like this:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://s3.amazonaws.com/st-swagger-docs/testschema.json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

 

Now, yes, the file is being fetched, but it’s not processed because of it.

 

 

 

From: <swagger-sw...@googlegroups.com> on behalf of Gregg Fiehler <gregg....@gmail.com>
Reply-To: "swagger-sw...@googlegroups.com" <swagger-sw...@googlegroups.com>
Date: Tuesday, December 5, 2017 at 09:02
To: Swagger <swagger-sw...@googlegroups.com>
Subject: Re: Swagger Editor external reference local file vrs. remote

 

 

https://s3.amazonaws.com/st-swagger-docs/testschema.json#/definitions/PostalAddress

 

I had a typo in the URL I sent before, but that is not what is in my swagger document so I am unsure how I messed that up.

--

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

Gregg Fiehler

unread,
Dec 5, 2017, 4:42:58 PM12/5/17
to Swagger
Thanks Ron, I set the CORS config and now it works.  I thought CORS did not fetch the document if it did not get the proper CORS response so I did not look for that.  I really appreciate your time and patience.

Cheers
Gregg


Reply all
Reply to author
Forward
0 new messages