Comments (8)
@timburks or colleagues?
from generator.
FYI, there is a tool that can generate Go and PHP code for message models.
json-cli gen-go "https://raw.githubusercontent.com/asyncapi/asyncapi/2.0.0-rc1/examples/1.2.0/streetlights.yml" \
--ptr-in-schema "#/components/messages/lightMeasured/payload" "#/components/messages/turnOnOff/payload" \
--def-ptr "#/components/schemas" \
--package-name message \
--output ./entities.go
// Code generated by github.com/swaggest/json-cli v1.6.3, DO NOT EDIT.
// Package message contains JSON mapping structures.
package message
import (
"fmt"
"time"
)
// LightMeasuredPayload structure is generated from "#/components/schemas/lightMeasuredPayload".
type LightMeasuredPayload struct {
Lumens int64 `json:"lumens,omitempty"` // Light intensity measured in lumens.
SentAt *time.Time `json:"sentAt,omitempty"` // Date and time when the message was sent.
}
// TurnOnOffPayload structure is generated from "#/components/schemas/turnOnOffPayload".
type TurnOnOffPayload struct {
Command TurnOnOffPayloadCommand `json:"command,omitempty"` // Whether to turn on or off the light.
SentAt *time.Time `json:"sentAt,omitempty"` // Date and time when the message was sent.
}
// TurnOnOffPayloadCommand is an enum type.
type TurnOnOffPayloadCommand string
// TurnOnOffPayloadCommand values enumeration.
const (
TurnOnOffPayloadCommandOn = TurnOnOffPayloadCommand("on")
TurnOnOffPayloadCommandOff = TurnOnOffPayloadCommand("off")
)
// MarshalJSON encodes JSON.
func (i TurnOnOffPayloadCommand) MarshalJSON() ([]byte, error) {
switch i {
case TurnOnOffPayloadCommandOn:
case TurnOnOffPayloadCommandOff:
default:
return nil, fmt.Errorf("unexpected TurnOnOffPayloadCommand value: %v", i)
}
return json.Marshal(string(i))
}
// UnmarshalJSON decodes JSON.
func (i *TurnOnOffPayloadCommand) UnmarshalJSON(data []byte) error {
var ii string
err := json.Unmarshal(data, &ii)
if err != nil {
return err
}
v := TurnOnOffPayloadCommand(ii)
switch v {
case TurnOnOffPayloadCommandOn:
case TurnOnOffPayloadCommandOff:
default:
return fmt.Errorf("unexpected TurnOnOffPayloadCommand value: %v", v)
}
*i = v
return nil
}
from generator.
I'm working on one now but I definately need some help. At the moment have simpe strcut generation for messages but need to add some tests.
from generator.
Hey @vgarvardt! I'm planning to work on one too. Join the Slack channel and let's work together on this.
from generator.
Lovely! Thanks for sharing!
from generator.
@vgarvardt hey man, are you still in the topic? I don't think that @fmvilas is still involved in writing a template but seems more people are interested #209 so would be good to join forces maybe?
from generator.
This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️
from generator.
Closing this one
Discussions should be under one issue #209
from generator.
Related Issues (20)
- Improve arborist (npm installation) to have no hacks HOT 4
- Allow $$operation$$ file template HOT 2
- `noOverwriteGlobs` will not work in majority of cases in templates using react HOT 10
- Proposal for mentorship of potential maintainers of generator -> `Becoming a Maintainer of AsyncAPI Generator` HOT 22
- [BUG] Demo from homepage does not work HOT 9
- Need to add proper options to generate the template from private registory using CLI HOT 2
- Allowing Generator to pull the templates from the private GitHub Repository HOT 1
- [Docs Bug 🐞 report]: The `template-constant` link is broken at the generator docs HOT 6
- [Docs Bug 🐞 report]: The `AsyncAPI document` button is broken at the generator docs HOT 3
- [📑 Docs]: Improve documentation related to `File templates` feature HOT 8
- `conditionalFiles` feature is broken when template uses `server` special parameter HOT 1
- Incoming changes for generator HOT 3
- Support platform generator type templates to infrastructure as code HOT 4
- [BUG] Docker container html template is not compatible with generator HOT 3
- Figure out what development flow will be without cli.js HOT 4
- Add Post-installation script for Cli.js deprecation and migration
- Migration Guide to md & post-installation script to deprecate `cli.js` HOT 4
- create our own changeset bot HOT 1
- Provide a development.md or **Development Guide** in readme where you explain how to start project locally and do some basic manual tests and how to run existing tests in isolated docker env HOT 1
- Put all (most) templates into the generator together for better developers' experience HOT 7
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 generator.