Class and constructor variables are named after ref schema class
Describe the bug
Class and constructor variables are named after ref schema class name which does not compile. We are only using this template because of the handy artifactType param that can be set to library because we want the models only.
How to Reproduce
Define a schema with props referencing another schema e.g.:
components:
schemas:
MySchema:
type: object
properties:
prop1:
$ref: '#components/schemas/MyOtherSchema'
prop2:
$ref: '#components/schemas/MyOtherSchema'
MyOtherSchema:
type: object
properties:
value:
type: number
unit:
type: string
Expected behavior
Expected behavior would be to generate a class MySchema with a constructor and member variables named after the prop names e.g.:
public class MySchema {
private MyOtherSchema prop1;
private MyOtherSchema prop2;
public MySchema(MyOtherSchema prop1, MyOtherSchema prop2) {
this.prop1 = prop1;
this.prop2 = prop2;
}
}
Actual behavior
Does not compile (variables already defined):
public class MySchema {
private MyOtherSchema myOtherSchema;
private MyOtherSchema myOtherSchema;
public MySchema(MyOtherSchema myOtherSchema, MyOtherSchema myOtherSchema) {
this.myOtherSchema = myOtherSchema;
this.myOtherSchema = myOtherSchema;
}
}
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.