Open rdecarreau opened 4 years ago
👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
I'm facing a very similar problem. Check "results" property below:
OpenAPI snippet:
PageElements:
type: object
properties:
page:
type: 'integer'
format: 'int32'
example: 5
size:
type: 'integer'
format: 'int32'
example: 20
totalPages:
type: 'integer'
format: 'int32'
example: 10
totalElements:
type: 'integer'
format: 'int64'
example: 189
results:
type: 'array'
items:
$ref: '#/components/schemas/Element'
Actual
type PageElements {
results: Element
page: Int!
size: Int!
totalPages: Int!
totalElements: Int!
}
Expected
type PageElements {
results: [Element]
page: Int!
size: Int!
totalPages: Int!
totalElements: Int!
}
May I know if you've time to contribute a fix? I can show you some good starting point.
Bug Report Checklist
Description
My spec has an array in it, when I run the generator, the model for the array is an empty type.
openapi-generator version
CLI version 4.2.3
OpenAPI declaration file content or url
Command line used for generation
java -jar codegen-cli.jar generate -i test.yml -g graphql-nodejs-express-server -o /out/graphql-nodejs-express-server --generate-alias-as-model
Steps to reproduce
Related issues/PRs
NA
Suggest a fix
This is a tough one. OpenAPI doesn't provide a
name
element for array types, but GraphQL requires that each property be named (sensibly). Maybe the generator can use the type name? ActualExpected