Comments (17)
Hi @gedw99, thank you for the useful information!
I do know NATS, but have little experience with it. As for the asynchronous specification, I've used CloudEvents, but have no idea about AsyncAPI, which is awesome!
Your idea of generating AsyncAPI document sounds interesting. Is there any example in your mind? What does the input and output of the generator look like?
from kun.
Well cloud event is agnostic and uses nats if you want.
there are no examples of asyncapi, but its not really needed because the core part is all golang and really well done from what i can see
https://github.com/orgs/asyncapi/repositories?q=&type=&language=go&sort=
https://github.com/asyncapi/event-gateway currently uses Kafka, but i think adding nats is not hard actually.
NATS is such a simple api. Their go.mod shows it uses watermill, the nats watermill is already there that can be integrated: https://github.com/ThreeDotsLabs/watermill-nats
Also from the go.mod you can see the gateway uses this parser github.com/asyncapi/parser-go, which i think is parsing the schema spec.
https://github.com/asyncapi/spec-json-schemas holds the spec versions. Pretty simple.
https://github.com/asyncapi/converter-go is just a spec upgrader.
The way this golang stuff hangs together is pretty clean IMHO.
from kun.
All the other repos in async api is all just for JS developers.
Its mostly Tons of complex tooling so as to give them a web based GUI.
Not needed in many ways. But there is a developer wants it.
from kun.
i started a discussion here: asyncapi-archived-repos/event-gateway#81
from kun.
Also the gateway can then be part of the Caddy proxy if you wanted. Just saw that you have one.
So then all Sync and async operations can be described from the Spec and used by caddy to forward everything to the correct Service.
Could also of course be just run inline.
Your way of using annotations means that the spec is generated
from kun.
Its kind of cool because you can embed the caddway and NATS Jetstream into a simple binary IF you want OR you can scale it out. Cant do that with kafka.
from kun.
ah i just realised that there are bindings.
Its a late bound architecture...
https://github.com/asyncapi/bindings/blob/master/nats/README.md
from kun.
Found an example: https://github.com/asyncapi/ts-nats-template
they lean towards generating JS based clients.
but generating nats or other golang client is possible of course.
from kun.
Sounds great! Welcome to add the AsyncAPI document generator you expected ;)
Just FYI, here are the generation methods currently used in kok:
- Runtime reflection (based on reflect) for generating OpenAPI Specification
- We can not use static analysis here, since the requests and responses may be manipulated dynamically by custom HTTP codecs.
- Static analysis (based on go/packages) for generating Protocol Buffers
from kun.
sorry about not following up.. Got snowed under with other work stuff.
I realised after messing around with ideas that the most powerful thing that i can do with kun is to parse golang structs to JSONSchema. Then at runtime i can use these JSON Schemas for runtime checks and events and a myriad of things.
Its nice too because you work in Golang, gen your JSONSchema that represent those structs. Forward engineering.
Then you can build systems that are loosely coupled at runtime.
from kun.
Hi @gedw99, here is an attempt to add support for generating handlers for Event Subscribers #27. (Does not yet support generating AsyncAPI documentation.)
I realised after messing around with ideas that the most powerful thing that i can do with kun is to parse golang structs to JSONSchema.
Sounds good! Then it's recommended to use static analysis (based on go/packages). Maybe you could take a look at the implementation of the gRPC parser :)
from kun.
Hey Hey
Looks great. Whats the transport ? I assume websockets ? I ask because i want to be able to compile the generated golang client so that the GUI works with GIOUO: https://github.com/gioui. nhooyr.io/websocket works with GIOUI.
here is a graphql client that uses it and works with GIOUI just to give you an example of what i mean: https://github.com/hasura/go-graphql-client
from kun.
About AsyncAPI. You want to use their system to run it ?
from kun.
Whats the transport ? I assume websockets ?
The current design is meant to be generic, so there's no assumption about the transport for now. We currently use Kafka, but any other transport can use the generated handlers.
About AsyncAPI. You want to use their system to run it ?
Not intend to do so. But I think it's specially suitable for generating documentation (much like OpenAPI).
from kun.
I don’t us Kafka . Is it possible you could add a Kafka docker to the repo to get me going ? As well as a make file to make it obvious how to use it
from kun.
As mentioned above, any transport/broker (e.g. WebSocket, Kafka, Redis or even HTTP) can use the generated handlers. As an example, eventsvc just use a simple Go program to trigger the handlers.
from kun.
thanks the eventsrc example helps..
from kun.
Related Issues (17)
- Add support for request validation
- Add support for `@kok(alias)`
- Add support for the gRPC transport
- Add support for using blank identifiers in `@kok(param)`
- Improve the interface parser
- Redesign the annotation syntax
- Minor syntax improvements for `//kok:param`
- Rename this project HOT 4
- annotation: Add support for multiple HTTP operations
- Invalid literal error when generating code for an Interface
- OpenAPI v3.1., v3.0 HOT 3
- Add support for the business level input validation HOT 1
- Refactor the HTTP Codec
- Simplify the annotation syntax for kok(param)
- Add support for patching existing codecs
- Simplify werror
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kun.