-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcrud-spec-full.yaml
More file actions
230 lines (230 loc) · 5.83 KB
/
crud-spec-full.yaml
File metadata and controls
230 lines (230 loc) · 5.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# yaml-language-server: $schema=https://raw.githubusercontent.com/mzivkovicdev/spring-crud-generator/main/docs/schema/crud-spec.schema.json
configuration:
database: postgresql
javaVersion: 21
springBootVersion: "4" # valid formats are also 4.0.1 or 4.0
optimisticLocking: true
docker:
dockerfile: true
dockerCompose: true
app:
image: eclipse-temurin
port: 8080
db:
image: postgres
port: 5432
tag: latest
cache:
enabled: true
type: REDIS
expiration: 5
# maxSize: 10000 use for CAFFEINE
rateLimiting:
enabled: true
type: IN_MEMORY # IN_MEMORY | REDIS
keyStrategy: IP # IP | API_KEY | HEADER | AUTHENTICATED_USER
# keyHeader: X-Client-Id # only used when keyStrategy: HEADER
global:
capacity: 100
refillTokens: 100
refillDuration: 60 # seconds (100 req/min)
# overdraft: # optional burst control
# capacity: 20
# refillTokens: 20
# refillDuration: 10
response:
statusCode: 429
includeHeaders: true
message: "Rate limit exceeded. Please try again later."
openApi:
apiSpec: true
generateResources: true
graphql:
enabled: true
scalarConfig: true
errorResponse: simple
migrationScripts: true
tests:
unit: true
dataGenerator: instancio
additionalProperties:
rest.basePath: /api/v1
rest.response.excludeNull: true
optimisticLocking.retry.config: true
optimisticLocking.retry.maxAttempts: 5
optimisticLocking.backoff.delayMs: 100
optimisticLocking.backoff.multiplier: 2.0
optimisticLocking.backoff.maxDelayMs: 1000
spring.jpa.open-in-view: false
github.actions: true
packages:
annotations: annotation
businessservices: businessservice
configurations: configuration
controllers: controller
enums: myenums
exceptions: exception
generated: generated
mappers: mapper
models: persistance.entity
resolvers: graphql
repositories: persistance.repository
services: persistance.service
transferobjects: transferobject
entities:
- name: ProductModel
storageName: product_table
description: "Represents a product"
bulk:
create:
enabled: true
sort:
allowedFields: [name, price, releaseDate]
defaultDirection: ASC
fields:
- name: id
type: Long
description: "The unique identifier for the product"
example: 1
id:
strategy: TABLE
- name: name
description: "The name of the product"
type: String
example: "Gaming monitor"
column:
nullable: false
updateable: true
unique: true
length: 100
validation:
required: true
notBlank: true
minLength: 10
maxLength: 100
- name: price
description: "The price of the product"
type: Integer
column:
nullable: false
validation:
required: true
min: 1
max: 100
- name: users
type: UserEntity
relation:
uniqueItems: true
type: OneToMany
fetch: LAZY
cascade: MERGE
joinColumn: product_id
validation:
required: true
minItems: 1
maxItems: 10
- name: uuid
description: "The unique identifier for the product"
type: UUID
column:
nullable: false
validation:
required: true
- name: releaseDate
description: "The release date of the product"
type: LocalDate
- name: details
type: JSON<List<ProductDetails>>
- name: status
description: "The status of the product"
type: Enum
values:
- ACTIVE
- INACTIVE
- name: OrderTable
storageName: order_table
description: "Represents an order"
fields:
- name: orderId
type: Long
description: "The unique identifier for the order"
id:
strategy: IDENTITY
- name: product
type: ProductModel
description: "Represents a product"
relation:
type: OneToOne
joinColumn: product_id
fetch: EAGER
cascade: MERGE
orphanRemoval: true
validation:
required: true
- name: quantity
type: Integer
column:
nullable: false
validation:
required: true
min: 1
max: 100
- name: users
type: UserEntity
relation:
type: ManyToMany
fetch: LAZY
cascade: MERGE
joinTable:
name: order_user_table
joinColumn: order_id
inverseJoinColumn: user_id
validation:
required: true
minItems: 1
maxItems: 5
- name: UserEntity
storageName: user_table
description: "Represents a user"
softDelete: true
fields:
- name: userId
type: Long
id:
strategy: AUTO
- name: username
type: String
- name: email
type: String
validation:
required: true
email: true
- name: password
type: String
validation:
required: true
pattern: "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$"
- name: details
type: JSON<Details>
- type: List<String>
name: roles
- type: List<String>
name: permissions
validation:
notEmpty: true
- name: Details
description: "Represents a user details"
fields:
- name: firstName
type: String
- name: lastName
type: String
- name: ProductDetails
description: "Represents a product details"
fields:
- name: description
type: String
- name: weight
type: Double
- name: option
type: String