Closed codycoach closed 2 months ago
Hello @codycoach ! Thanks for your interest in this project ☺️
Sorry about that, I didn't think of this when splitting struct in substructures. I will write a fix for this and I'll let you know when it will be live :)
Hello @codycoach ! Thanks for your interest in this project ☺️
Sorry about that, I didn't think of this when splitting struct in substructures. I will write a fix for this and I'll let you know when it will be live :)
Thanks for your fast response :),
I found the workaround for this case with this spec.
asyncapi: 3.0.0
info:
title: Hello world application
version: '0.1.0'
channels:
hello:
address: 'hello'
messages:
sayHello:
payload:
type: object
properties:
data:
$ref: '#/components/schemas/helloData'
foo:
address: 'hello'
messages:
bar:
payload:
type: object
properties:
data:
$ref: '#/components/schemas/fooData'
operations:
receiveHello:
action: 'receive'
channel:
$ref: '#/channels/hello'
components:
schemas:
helloData:
type: object
properties:
id:
type: string
hello:
type: string
fooData:
type: object
properties:
id:
type: string
bar:
type: string
and the output would be
...
type SayHelloMessagePayload struct {
Data *HelloDataSchema `json:"data"`
}
...
type BarMessagePayload struct {
Data *FooDataSchema `json:"data"`
}
...
You may close this issue and prefer this solution with covered by the document and unit test.
Yes, it's indeed a way to solve this problem!
But I really don't like that a valid AsyncAPI document can't render valid generated code. So I think I'll just add a prefix on type with the parents name :)
Hi guys.
I found the issue when I tried to generate properties as objects in the same name. it redeclared my object property in the same package. Do you guys have any workaround for this one?
Sample Spec input
Sample Output: