-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[BUG] 3.1.0 Missing type for array when using allOf and $ref #18291
Comments
thanks for reporting the issue. i've filed #18297 to fix it |
PR merged. please pull the latest master to give it a try to use the snapshot version mentioned in the project's readme |
I'm still experiencing this bug. The related bug reported in #18290 is fixed by #18297 (so I am indeed running the correct version), but this one remains. The resulting code is same as in the first comment. openapi-generator-cli 7.5.0-SNAPSHOT |
just did another test with
not sure exactly why it's not working in your side |
Hm, strange. I tested on another computer to ensure there's not some strange caching causing the issues. Still getting this bug, but not the other one. This is how I install and run the generator:
I tested it on NixOs Linux and Macbook Air M1, using the same steps with nix in both cases. I'll ask my coworker to see if he can reproduce this bug with the latest master. |
Sorry. I didn't test it correctly. I'm now able to repeat the issue but couldn't find a solution yet. please revert to 3.0.1 spec for the time being |
I missed this issue when reporting the bug: There are more details about the bug there. |
@am-on I've filed #18577, which seems to fix the issue diff --git a/model_bar.go b/model_bar.go
index 0f57fe5..0ed5ca1 100644
--- a/model_bar.go
+++ b/model_bar.go
@@ -21,7 +21,7 @@ var _ MappedNullable = &Bar{}
// Bar struct for Bar
type Bar struct {
- ArrayOfStrings []interface{} `json:"arrayOfStrings"`
+ ArrayOfStrings []string `json:"arrayOfStrings"`
}
type _Bar Bar
@@ -30,7 +30,7 @@ type _Bar Bar
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
-func NewBar(arrayOfStrings []interface{}) *Bar {
+func NewBar(arrayOfStrings []string) *Bar {
this := Bar{}
this.ArrayOfStrings = arrayOfStrings
return &this
@@ -45,9 +45,9 @@ func NewBarWithDefaults() *Bar {
}
// GetArrayOfStrings returns the ArrayOfStrings field value
-func (o *Bar) GetArrayOfStrings() []interface{} {
+func (o *Bar) GetArrayOfStrings() []string {
if o == nil {
- var ret []interface{}
+ var ret []string
return ret
}
@@ -56,7 +56,7 @@ func (o *Bar) GetArrayOfStrings() []interface{} {
// GetArrayOfStringsOk returns a tuple with the ArrayOfStrings field value
// and a boolean to check if the value has been set.
-func (o *Bar) GetArrayOfStringsOk() ([]interface{}, bool) {
+func (o *Bar) GetArrayOfStringsOk() ([]string, bool) {
if o == nil {
return nil, false
}
@@ -64,7 +64,7 @@ func (o *Bar) GetArrayOfStringsOk() ([]interface{}, bool) {
}
// SetArrayOfStrings sets field value
-func (o *Bar) SetArrayOfStrings(v []interface{}) {
+func (o *Bar) SetArrayOfStrings(v []string) {
o.ArrayOfStrings = v
} |
Tested #18577. It fixes the issue for me. |
thanks for testing the fix, which has been merged |
Bug Report Checklist
Description
When using
allOf
and$ref
, the array from the referenced object doesn't include type.Elm
Golang
openapi-generator version
openapi-generator-cli 7.5.0-SNAPSHOT
commit : f357be4
OpenAPI declaration file content or url
Generation Details
Elm:
Golang:
Steps to reproduce
Use the provided OpenAPI declaration file and generate code.
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: