Use HL7-FHIR standard in Golang - go

Is there a suitable package to be able to use the FHIR standard in Golang? There should be a small dependency on the Google Cloud.

One way of using FHIR in Golang is the FHIR Protocol Buffers implementation: https://github.com/google/fhir
This includes a Golang parser/serializer for JSON to protobuf, which will get you language-specific data structures. It doesn't include a library for the FHIR REST API but you can use standard http libraries for that.

Related

Generate OpenAPI spec from gin project

Is there a way to generate OpenAPI spec files from a gin project? This issue is really hard to search for, all I could find so far are on doing there reverse.
gin-swagger is extracting comments from your code.
Running swag init generates :
docs.go: To serve SwaggerUI pages
swagger.json: The Swagger Specification in json file format.
swagger.yaml: The Swagger Specification in yaml file format.
You mean API docs for API user?
I saw you tag the question with swagger.
You have two chooses:
go-swagger
This package contains a golang implementation of Swagger 2.0 (aka OpenAPI 2.0): it knows how to serialize and deserialize swagger specifications.
swag
Swag converts Go annotations to Swagger Documentation 2.0. We've created a variety of plugins for popular Go web frameworks. This allows you to quickly integrate with an existing Go project (using Swagger UI).
What difference between them?
Here is the answer from go-swagger:
The main difference at this moment is that this one actually works...
The swagger-codegen project (like swag) only generates a workable go client and even there it will only support flat models. Further, the go server generated by swagger-codegen is mostly a stub.
Detail of this answer in How is this different from go generator in swagger-codegen?
from go-swagger.

File upload with SPQR Graphql

I'm using spring boot and spqr graphql library. I need to upload a file(s) via graphql. I don't know what object type to expect in the service and I'm assuming that this isn't even supported.
Has anyone tried this? Any advice?
Thanks.
(Assuming you're using SPQR Spring Starter)
Uploading/downloading binaries is currently inconvenient in SPQR, but not impossible. You'd need to override the provided controller with your own and decide how you want to receive the queries and binaries, and how you want to send the results and binaries back. To override the controller, just provide your own bean of GraphQLController type.
Your best bet is implementing the GraphQL multipart request spec which thanks to Spring shouldn't be too complicated.
Btw you can always get to the raw request by injecting #GraphQLRootContext DefaultGlobalContext<NativeWebRequest> request as a method argument. From there you can obtain input and output streams.
You can also wire in a custom ArgumentInjector that can inject something more precise if you want.
In the near future, the starter will support the GraphQL multipart request spec out of the box.
If you're not using the starter, the situation is similar in that you're kind of on your own with implementing the transport for binaries and queries.
But, with all that said, it is generally a best practice to handle dealing with binaries outside of GraphQL completely (only send download URLs and such using GraphQL), so I highly recommend that approach if possible. The reason is that requiring optional specs breaks out-of-the-box compatibility with most clients.

How to configure a named resource stream using OData in ASP.NET Web API

I am creating OData endpoints using ASP.NET Web API using v5.8.0 of this NuGet package. I have everything working and I can retrieve simple data such as strings and ints without an issue. However I would now like to extend one of the endpoints so that one of the items that can be retrieved is a binary image file. Having read up on OData I have decided to use named resource streams to achieve this.
The problem I have is that I can find very little information on how to implement this using the ODataController. The closest I can find is this blog post but it is using an older version of Web API and the code does not compile when I use it in my project.
So can somebody please supply a working example of how this should be implemented please.
Named streams (aka stream properties) are not currently supported in Web API OData (for OData v4). See the following issues:
Clarify the situation for streams
Document for Stream Support in OData V4

Can Swagger support Protobuf or WebSockets?

I want my Swagger output to have support for Protobuf and Websockets. (Protobuf is the most important)
Based on this issue, I don't think that swagger can support that. My goal is to allow end users to see the value of the Protobuf format since they are all asking me to use JSON instead.
I would contribute myself, but I'm unfamiliar with the swagger project at that level.
Question
Is there any way to get Swagger to support Protobuf or WebSockets?

Projects using Protobuf

I'm looking for some projects using Protobuf to use as a reference for implementing complex protocols. Netty examples are preferred but not required.
ActiveMQ uses the protobuf for the underlying KahaDB Message store
The LocalTime example that comes with Netty helped me a lot to understand how to use protobuf, try to learn from it.
Link: here

Resources