-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redeclared the struct name in the same package problem #190
Comments
Hello @codycoach ! Thanks for your interest in this project Sorry about that, I didn't think of this when splitting struct in substructures. |
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:
The text was updated successfully, but these errors were encountered: