By default Payload provides an auto-generated ID field for collections. In this case, you don't need to provide an ID field in the field definition of the collection.
The payload-openapi generator does not seem to take this into account. The generated Swagger schema definition is lacking an ID field for Payload collections which use auto-generated IDs. Consequently, the data transfer objects which are generated by openapitools based on the Swagger specification lack an id field, even though the payload request response contains IDs for the transferred data objects.
For example, we have a Payload collection "Workshop" with auto-generated ID field and this is what the generated Swagger schema definition looks like:
Notice that the id is contained in list of properties.required but not present in the properties definition
What did you expect
Swagger schema definition for a Payload collection with auto-generated ID must contain an additional property id of typestring, e.g.
Setps to reproduce
Create a Payload CollectionConfig without an id field, in order to let Payload create an auto-generated ID for this collection, e.g.:
Package name
payload-openapi
What happened?
By default Payload provides an auto-generated ID field for collections. In this case, you don't need to provide an ID field in the field definition of the collection. The
payload-openapi
generator does not seem to take this into account. The generated Swagger schema definition is lacking an ID field for Payload collections which use auto-generated IDs. Consequently, the data transfer objects which are generated by openapitools based on the Swagger specification lack an id field, even though the payload request response contains IDs for the transferred data objects.For example, we have a Payload collection "Workshop" with auto-generated ID field and this is what the generated Swagger schema definition looks like: Notice that the
id
is contained in list ofproperties.required
but not present in theproperties
definitionWhat did you expect
Swagger schema definition for a Payload collection with auto-generated ID must contain an additional property
id
oftype
string
, e.g.Setps to reproduce
Create a Payload
CollectionConfig
without anid
field, in order to let Payload create an auto-generated ID for this collection, e.g.:Tool version
^1.4.0
Payload version
^2.0.0
Node version
20.10.0