Giter Club home page Giter Club logo

Comments (10)

Alan-Cha avatar Alan-Cha commented on August 23, 2024

OASGraph currently does not support external references. I will file an issue for this.

Try copying and pasting the components into your OAS and see if you have any other issues.

from openapi-to-graphql.

candysmurf avatar candysmurf commented on August 23, 2024

@Alan-Cha, thanks for your quick response. Did you mean copying the path into your example at https://github.com/strongloop/oasgraph/blob/master/docs/tutorials/watson.md. After that, how do I run it?

from openapi-to-graphql.

Alan-Cha avatar Alan-Cha commented on August 23, 2024

This could be either pretty easy or a bit involved depending on what your OAS looks like.


You will probably see the following line somewhere in your OAS:

"$ref": "http://redfish.dmtf.org/schemas/v1/ServiceRoot.v1_4_0.yaml#/components/schemas/ServiceRoot"

To reiterate, the problem is that OASGraph currently does not support external references.


I followed the link and discovered that the document is in YAML so the first thing you will need to do is convert it to JSON.

Next, you should check to see how many external references are present in your OAS.

If this is the only external reference, then all you need to do is replace line above with the ServiceRoot schema.

If there are multiple external references, then you should consider pulling in the full components object and changing all the references to local references.

To go into more detail, first check if you don't already have a preexisting components object in your OAS. If so, great! You can just copy the full components object into your OAS. If not, you will need to make sure make sure you do not have any collisions. Then, you will need to change all your external references to local references, which if they have the same form as above, should look like the following:

"$ref": "#/components/schemas/ServiceRoot"

from openapi-to-graphql.

candysmurf avatar candysmurf commented on August 23, 2024

@Alan-Cha, thanks for the detailed explanation. I saw a few external links however there is no components object inside OAS yaml file. If I copy all components object, do I need to follow each component link to copy each of them? thanks.

from openapi-to-graphql.

Alan-Cha avatar Alan-Cha commented on August 23, 2024

If all the links start with http://redfish.dmtf.org/schemas/v1/ServiceRoot.v1_4_0.yaml, then that is probably the only components object you need.

If the external references point to different component objects, then you will need to combine them, which could mean you will encounter collisions.


In the end, you just need to satisfy the reference. Unfortunately, OASGraph currently does not support external references so you will have to either replace them with whatever they are referencing (for example, copying and pasting schema objects wherever the references are) or change them into local references (copying and pasting the entire components object at the root level and modifying the reference links).

from openapi-to-graphql.

Alan-Cha avatar Alan-Cha commented on August 23, 2024

I will close this issue because I have filed issue #65 but please feel free to ask more questions in this thread! 😄

from openapi-to-graphql.

ErikWittern avatar ErikWittern commented on August 23, 2024

@candysmurf You stated "there is no components object inside OAS yaml file". This could likely be the case because you are using an API specification written in OpenAPI Specification 2.0 (aka "Swagger"), which does not have a components object. In that case, there should be a definitions object, though, which contains descriptions of the data being sent to or returned from the API. Maybe within the referenced "ServiceRoot.v1_4_0.yaml" there is also a definitions object from which you could copy the ServiceRoot schema definition?!

from openapi-to-graphql.

candysmurf avatar candysmurf commented on August 23, 2024

I would like to follow up on this. We decided to use OASGraph and would like to see if you support yaml file and external references yet? @Alan-Cha & @ErikWittern

from openapi-to-graphql.

Alan-Cha avatar Alan-Cha commented on August 23, 2024

@candysmurf We added YAML support to the CLI tool (although we have yet to release a new version). We do not plan on adding external reference resolution right now, however. Although this would be a nice feature to have, we wonder if it lies outside the scope of OASGraph. This should be a library of its own.

from openapi-to-graphql.

candysmurf avatar candysmurf commented on August 23, 2024

from openapi-to-graphql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.