GraphQL: Generate static documentation from SDL file - node.js

The NPM library graphql-docs will statically generate GraphQL API documentation from a successful schema introspection call against the API server.
I need to similarly generate GraphQL API documentation, but based on an SDL file rather than from an introspection call.
I know I can generate a server stub from my SDL at built time and introspect against that, but this seems like overkill.
Is there a library or a tool-chain, in any language, that makes generating docs from an SDL file simple?

I've messed around with graphdoc before, which can generate static documentation from an SDL file, JSON or even graphql-tools' executableSchema. I don't think there's a lot of other tools out there, since most teams just rely on GraphiQL or GraphQL Playground for their documentation needs.

I recommend https://github.com/2fd/graphdoc to generate a static doc of a GraphQL endpoint.

There are now 2 more recent open source projects to do that.
Magidoc
SpectaQL
Both support creating static docs from SDL files or introspection query.

Related

Node Express API - Object Mapper

We have created a new Node JS API using Express Framework (Typescript as scripting language). This API internally calls an external API. In order to call the external API from within our API, we need to do a translation of the API models to External API Models. Are there any NPM Packages that are available which does the Object to Object mapper?
As i understood your problem i recommend this package which i really find usefull for typescript backends: class-transformer
the github link : https://github.com/typestack/class-transformer#classtoclass
Also automapper-ts is a good choice too: https://github.com/loedeman/AutoMapper
i don't need to explain more than that i think. they have a good docs there. I hope it helps.

node-quickbooks vs intuit-oauth

I am doing research on quickbooks online integration using node and angular 8.
The official intuit developer site provides two node packages.
one is official from intuit and one is from community.
I have glanced through both of them.
the official package is fairly universal. It essentially is just a API client to send a request to remote server and the payload is basic json format.
the community package seems a bit more specific but the documentation seems a bit confusing.
Which one would you choose to do the work and why?
I would love to hear your input.
Thanks :)
The Intuit provided library (intuit-oauth) is specifically for authenticating and getting the OAuth token you need to communicate with the Quickbooks API, the other library (node-quickbooks) is for making the actual calls against the API endpoints.
You will need both libraries, unless you are handling authentication in a different way.
Fwiw for whoever finds this useful:
I forked intuit-oauth, added typescript and fixed vulnerabilities that have been fixed in the PRs of their repo for years and never updated here: https://www.npmjs.com/package/intuit-oauth-ts
Additionally I forked node-quickbooks, updated the api to return promises rather than relying on callbacks, resolved the discovery URLs automatically, changed the format of response objects to be more sensible, and added (unfortunately only some) of the typescript definitions for it here: https://www.npmjs.com/package/qbo. I don't have enough time to add the definitions for all of the files (largey because the included ones should be completely exhaustive for every property in the QBO api, which is timeconsuming to define). If someone would like to contribute by adding more of the typescript definitions or adding all of them, I would really appreciate it.
I am interested in any example angular app using intuit-oauth
Trying to work it out but getting issues since there is no document for typescript.

Yesod - shared types between server and client

I'm used to working with Dart, where sharing types between server and client is as simple as importing the relevant packages into your project.
Can something similar be accomplished with Yesod/Haskell? Should I use GHCJS for the client? Maybe Elm? The goal is not having to worry about the data getting mangled in transit between server and client - and also not having to write a single line of JS. :o)
I haven't been able to find any good, beginner friendly docs on how to best tackle this challenge using Haskell. I suspect I just haven't looked in the right places. Any and all help is more than welcome.
To achieve this with GHCJS you can just build your project out of three core packages in this fashion:
frontend - something based on ghcjs-dom, I like Reflex-dom
backend - use your favorite framework, I like Snap, Yesod should work just the same
shared - code shared between frontend and backend
Where frontend and backend both depend on shared of course. Frontend is compiled with GHCJS, backend with GHC.
If you would like to see a complete example I would highly recommend studying hsnippet. Take a look at WsApi.hs where a set of up and downstream messages is being defined. All the JSON instances are derived in one place and imported in both frontend and backend.
Hsnippet uses websockets. This is not a requirement of course. You could use regular XHR in your own app. The principle stays the same. You define your API and serialization instances (usually JSON) in the shared package and import the relevant modules in both frontend and backend.
Personally I also share validation code, database entity definitions generated with persistent etc. Once you set it up sharing additional stuff is mostly a copy paste to one of the shared modules and then import wherever.

How to generate node.js API docs using swagger

I have an application developed with Node.js/expressjs. It's working fine. Now I need to generate API document using Swagger. There is a module swagger-node. Do I need to re-write the whole app using this module or is there any other solution to use this module and what is the use of swagger-ui if using swagger-node.
Not from what I can tell. You should be able to generate your swagger project as described, and then just make sure that the information in the yaml file points to the actual controllers and methods that your code uses.
You can create a standalone yaml file that is compliant with Swagger/OpenAPI which can therefore be rendered into Swagger documentation. The Swagger-UI is useful for creating this yaml file. Swagger also offers various tools for testing APIs and generating code -- to use these effectively you will need a method for integrating the controller/model definitions in your yaml file into your existing codebase.
To achieve this integration I typically expose my existing codebase as an api of controller functions -- then import it as a module into the code generated by my documented API. This allows me to trust my API documentation without the burden of porting my whole codebase into Swagger's required directory structure. I believe this is the best currently available approach but is not always worthwhile.

Haskell: which SOAP client lib to use?

I'd like to write s simple Haskell program that connects to a SOAP service. Ideally I'd like to use the service's WSDL and get as straightforward access to the request parameters and response data as possible.
What library do I use?
So far I only found HAIFA but it seems to have stopped developing around 2006, so I'm not sure if it's the right choice.
Update 2015-08-14: As of now, a package named soap, along with protocol support packages soap-tls and soap-openssl is available on hackage and looks alive.
As #sclv says, the SOAP heyday was before Haskell was seriously used for web systems. As a result your options for fully-fledged SOAP libs are somewhat restricted.
Obviously, HAIFA was the biggest effort back in the day, but it isn't on Hackage, so you're mostly out of luck there. Looks like shoap was a bit of an attempt at getting something simple working as well.
For rolling your own, there are plenty of XML options to choose from on Hackage,
HaXML,
haxr
fancy "conduit"-style xml parsing

Resources