Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Alan Cha
    @Alan-Cha
    Hello everyone!
    Please feel free to ask any questions here!
    manjunaths222
    @manjunaths222
    Hi @Alan-Cha . Is there any updated on when the issue IBM/openapi-to-graphql#131 could be resolved? Even I am facing the same issue what is mentioned there. Operation names are like "accessRoles2", "getResources3" etc.
    Alan Cha
    @Alan-Cha
    @manjunaths222 Hey! Most of the time, the appended numbers are unavoidable. With the given information provided by the OAS
    With the given information provided by the OAS and trying to create a generalizable solution, this is the best we can do in most circumstances.
    However, we have provided the operationIdFieldNames options to allow the user to manually specify the
    field names.
    Alan Cha
    @Alan-Cha
    We are also exploring trying to auto-generate singular field names
    Take a look at PR #185 for more information
    manjunaths222
    @manjunaths222
    Thanks a lot for @Alan-Cha for your quick response.
    Alan Cha
    @Alan-Cha
    @manjunaths222 No problem! Feel free to ask any other questions as they come up! :smile:
    Chaitanya Bendalam
    @chaitu0609
    @Alan-Cha Is there any possibility for adding SSL into GraphQL server
    Alan Cha
    @Alan-Cha
    @chaitu0609 To clarify, are you talking about making the resolvers makings calls using HTTPS or are you talking about the generated GraphQL server (presumably from using the CLI)?
    Alan Cha
    @Alan-Cha
    Both should be possible I believe
    For the former, it is simply a matter of pointing to a server that uses HTTPS in the OAS, then all API calls will be made over HTTPS
    For the latter, the library just creates a schema and resolvers, so it up to the user to set up the GraphQL server. The CLI on the other hand, which is just a wrapper for the library, uses express-graphql to create the GraphQL server.
    I'm not too how to do it, but I think there are ways to use SSL using the express library. If you could look into it, I think we can create a PR together to create an option (or just expose some preexisting ones provided by express-graphql). Let me know what you think!
    Chaitanya Bendalam
    @chaitu0609
    Thanks @Alan-Cha for your quick response
    Chaitanya Bendalam
    @chaitu0609
    @Alan-Cha When I added cookieAuth into openapi.json , I'm getting below mentioned warning when ran the GraphQL server
    We added the cookie auth in openapi explorer and exposing the GraphQL we are getting below error. Please help me on this to resolve it.
    MicrosoftTeams-image (6).png
    Alan Cha
    @Alan-Cha
    Hey! I’m so sorry for the late reply. I did not see the notification. Is it possible for you to share the OAS? Or at least describe how you added cookie authentication?
    Chaitanya Bendalam
    @chaitu0609
    @Alan-Cha, Please find attached json file which is having the the cookieAuth schema in API route in openapi.json file and components as empty object
    @Alan-Cha Above scenario only we are getting issue when we running the GraphQL server
    Alan Cha
    @Alan-Cha
    @chaitu0609 Sorry for the late reply. I believe the problem is that there is no securityScheme object to define how the cookieAuth works
    Basically, in the schema, you make a reference to a particular security requirement but there is no security scheme to define how the security requirement works so OtG doesn't know how to handle it.
    That's why you are getting this error. OtG finds a security requirement "cookieAuth" but the OAS does not describe how it works.
    Chaitanya Bendalam
    @chaitu0609
    @Alan-Cha I updated securitySchme accordingly. But When I added this Schme into openAPI graphq query and mutations are not working. There security schema is breaking
    Alan Cha
    @Alan-Cha
    @chaitu0609 Can you send the updated OAS?
    Is it something you can share?
    Chaitanya Bendalam
    @chaitu0609
    @Alan-Cha Please find above mentioned json file
    Peter Schwer
    @schwer
    hi y'all i just published a new project: https://www.npmjs.com/package/graphql-to-openapi
    it's intended to do the opposite of what openapi-to-graphql does. don't ask why anyone would want to, it's a long story.
    Alan Cha
    @Alan-Cha
    @schwer Thanks for the tip! Sounds interesting... will take a look
    Erik Wittern
    @ErikWittern
    @schwer Hah interesting. I know you said "don't ask", but I have to: is there a specific use-case you needed this for?
    (We observed that typically people already have some REST APIs, and don't know how to get going with GraphQL. But your library seems to be based on the opposite case...?!)
    Peter Schwer
    @schwer
    @ErikWittern - I agree, doesn't make a lot of sense to go the other way- consider a case where a team creates a monolithic graphql schema to support a front-end... and the graphql schema doesn't scale superbly. They have to pull some of the schema and move it into some RESTful endpoints that are load balanced.
    Peter Schwer
    @schwer
    @ErikWittern I was also interested in the possibility of opening up a graphql server to the possibility of speaking openapi, but that's a bigger project.
    Peter Schwer
    @schwer
    @ErikWittern Also, I am thinking of the myriad cases of legacy infrastructure- you want to be create a graphql api, but your internal systems are dependent on openapi- or you're using AWS API gateway... i think generally the project is intended to help approach those edgecases- not as a persistent server, but as a tool for devs.
    Pooja Rani
    @prani1_gitlab

    Hello folks :wave:

    I am Pooja Rani, software engineer from Red Hat, I am newbie to Graphql. I have few questions -

    I generated a schema using openapi-to-graphql here is a url http://graphql-gateway-pooja-project.apps.ca-central-1.starter.openshift-online.com/

    1) What's the suggested way to keep graphql schema in sync with openAPI, do i have to run library again to generate schema, evertime the openAPI changes ? OR should I manually apply the patch of changes ?

    2) Names of types which are generated from endpoints (like advisoriesRedhatId for /advisories/redhat/id/{identifier} doesn't make sense, what's the suggested fix ? will this require human intervension to fix this, we have got a large api.

    Thanks :)

    @Alan-Cha @ErikWittern ^
    Alan Cha
    @Alan-Cha

    @prani1_gitlab Hi! Nice to meet you!

    1) Yes, I believe you should run the library again every time the OAS changes. I'm not really sure what manually applying patches would mean or if it is even possible as the resolvers are stored in memory.

    2) There are a few ways you can change field names. First is operationIdFieldNames, which will utilize the operationIds specified in the OAS instead of generating names. There is also singularNames, which will employ a different method of name generation (although it is still somewhat experimental). Unfortunately, generating names is always a mixed bag. The former option allows you to manually and dependably configure field names.

    Let me know if you have any other questions!

    Pooja Rani
    @prani1_gitlab
    Thanks for the reply Alan, this helps me.
    Dhaval Shah
    @dhaval14_gitlab
    Hello, I am phasing an issue using openapi-to-graphql. I am getting following error:
    {
    "errors": [
    {
    "message": "Could not invoke operation GET /odin-external/rest/v1/payment-method",
    "locations": [
    {
    "line": 2,
    "column": 3
    }
    ],
    "path": [
    "searchByUserId"
    ],
    "extensions": {
    "method": "get",
    "path": "/odin-external/rest/v1/payment-method",
    "statusCode": 404,
    "responseHeaders": {
    "date": "Fri, 17 Jul 2020 20:38:20 GMT",
    "content-type": "application/json",
    "transfer-encoding": "chunked",
    "connection": "close",
    "vary": "Origin, Access-Control-Request-Method, Access-Control-Request-Headers"
    },
    "responseBody": {
    "httpCode": 404,
    "errors": [
    {
    "code": 0,
    "message": "Not found any payment methods for request!",
    "entity": null
    }
    ],
    "result": null
    },
    "code": "INTERNAL_SERVER_ERROR",
    "exception": {
    "message": "Could not invoke operation GET /odin-external/rest/v1/payment-method",
    "stacktrace": [
    "GraphQLError: Could not invoke operation GET /odin-external/rest/v1/payment-method",
    " at graphQLErrorWithExtensions (/Users/dhaval/graphql-server-example/node_modules/openapi-to-graphql/lib/resolver_builder.js:868:12)",
    " at Request.NodeRequest [as _callback] (/Users/dhaval/graphql-server-example/node_modules/openapi-to-graphql/lib/resolver_builder.js:428:32)",
    " at Request.self.callback (/Users/dhaval/graphql-server-example/node_modules/request/request.js:185:22)",
    " at Request.emit (events.js:198:13)",
    " at Request.<anonymous> (/Users/dhaval/graphql-server-example/node_modules/request/request.js:1154:10)",
    " at Request.emit (events.js:198:13)",
    " at IncomingMessage.<anonymous> (/Users/dhaval/graphql-server-example/node_modules/request/request.js:1076:12)",
    " at Object.onceWrapper (events.js:286:20)",
    " at IncomingMessage.emit (events.js:203:15)",
    " at endReadableNT (_stream_readable.js:1145:12)"
    ]
    }
    }
    }
    ],
    "data": {
    "searchByUserId": null
    }
    }
    Anyone know, how to resolve this issue?
    Dhaval Shah
    @dhaval14_gitlab
    My name is Dhaval, working at Chegg Inc as Senior Software Engineer. We are trying to integrate openapi-to-graphql to our node-framework.
    I have come across this issue, when api returns 404 response code with json response data back.
    Pooja Rani
    @prani1_gitlab

    Hi @dhaval14_gitlab

    May be you can try debugging by logging on server https://github.com/IBM/openapi-to-graphql/tree/master/packages/openapi-to-graphql#logging

    note: I am new too :)