@@ -24,7 +24,7 @@ export function inputBodyPostSchema(
24
24
camelToKebab ( getEntityName ( entity ) )
25
25
) ;
26
26
27
- const relDataType : Record < string , any > = {
27
+ const baseRelDataType : Record < string , any > = {
28
28
type : 'object' ,
29
29
properties : {
30
30
data : {
@@ -106,17 +106,17 @@ export function inputBodyPostSchema(
106
106
107
107
const uuidRelations = arrayPropsConfig . relationUuids || { } ;
108
108
const relationships = Object . keys ( relationsField ) . reduce ( ( acum , item ) => {
109
- const currentRelDataType = {
109
+ const relDataType = {
110
110
[ item ] : {
111
- ...relDataType ,
111
+ ...baseRelDataType ,
112
112
properties : {
113
- ...relDataType . properties ,
113
+ ...baseRelDataType . properties ,
114
114
data : {
115
- ...relDataType . properties . data ,
115
+ ...baseRelDataType . properties . data ,
116
116
properties : {
117
- ...relDataType . properties . data . properties ,
117
+ ...baseRelDataType . properties . data . properties ,
118
118
id : {
119
- ...relDataType . properties . data . properties . id ,
119
+ ...baseRelDataType . properties . data . properties . id ,
120
120
pattern : uuidRelations [ item ] ?. id
121
121
? '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'
122
122
: '^\\d+$' ,
@@ -134,11 +134,11 @@ export function inputBodyPostSchema(
134
134
} ;
135
135
136
136
const resultSchema = {
137
- ...currentRelDataType [ item ] . properties . data ,
137
+ ...relDataType [ item ] . properties . data ,
138
138
properties : {
139
- ...currentRelDataType [ item ] . properties . data . properties ,
139
+ ...relDataType [ item ] . properties . data . properties ,
140
140
type : {
141
- ...currentRelDataType [ item ] . properties . data . properties . type ,
141
+ ...relDataType [ item ] . properties . data . properties . type ,
142
142
...( arrayPropsConfig . relationType [ item ]
143
143
? {
144
144
enum : [
@@ -153,9 +153,9 @@ export function inputBodyPostSchema(
153
153
} ;
154
154
155
155
acum [ item ] = {
156
- ...currentRelDataType [ item ] ,
156
+ ...relDataType [ item ] ,
157
157
properties : {
158
- ...currentRelDataType [ item ] . properties ,
158
+ ...relDataType [ item ] . properties ,
159
159
data :
160
160
Reflect . getMetadata ( 'design:type' , entity [ 'prototype' ] , item ) ===
161
161
Array
0 commit comments