You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -16,7 +16,8 @@ This project is a [*jsonschema2pojo*](https://github.com/joelittlejohn/jsonschem
16
16
At the schema of an object level, it is possible to define a POJO as being a Couchbase document using the custom JSON
17
17
property `x-cb-document`.
18
18
19
-
* If missing, the value of this property is `false`.
19
+
* If missing, the value of this property is `true` if the schema is at root or if its parent is also a Couchbase
20
+
document.
20
21
* The `true` value is equivalent to `{}`.
21
22
* The schema of the content of this custom property is available [here](src/main/resources/schema/document.json).
22
23
@@ -28,7 +29,6 @@ E.g., this schema:
28
29
{
29
30
"title": "Sample entity",
30
31
"type": "object",
31
-
"x-cb-document": true,
32
32
"properties": {
33
33
"..."
34
34
}
@@ -67,6 +67,62 @@ public class Entity {
67
67
}
68
68
```
69
69
70
+
#### Composite indexes
71
+
72
+
A sub-property `compositeIndexes` is available to declare indexes that will can be auto-generated by Spring
73
+
Data Couchbase via the [`CompositeQueryIndex`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/index/CompositeQueryIndex.html)
74
+
annotation and its parameters (detailed in the annotation's documentation).
#### Exclude a POJO from Couchbase related elements
122
+
123
+
If `x-cb-document` is `false`, Couchbase related elements will be skipped for the generated class, also for its fields
124
+
and its sub-objects.
125
+
70
126
### Document id
71
127
72
128
At the property of an object level, it is possible to define a field as being a document id using the custom JSON
@@ -88,7 +144,6 @@ E.g., this schema:
88
144
"id": {
89
145
"title": "Entity id",
90
146
"type": "string",
91
-
"format": "uuid",
92
147
"x-cb-id": true
93
148
},
94
149
"..."
@@ -98,9 +153,11 @@ E.g., this schema:
98
153
Will produce:
99
154
```java
100
155
@Id
101
-
privateUUID id;
156
+
privateString id;
102
157
```
103
158
159
+
#### Generated id
160
+
104
161
A sub-property `generated` is available to manage the generating of the [`GeneratedValue`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/mapping/id/GeneratedValue.html)
105
162
annotation and its parameters (detailed in the annotation's documentation).
106
163
@@ -138,7 +195,6 @@ And this schema:
138
195
"id": {
139
196
"title": "Entity id",
140
197
"type": "string",
141
-
"format": "uuid",
142
198
"x-cb-id": {
143
199
"generated": {
144
200
"delimiter": "::",
@@ -253,13 +309,10 @@ Will produce:
253
309
privateString field;
254
310
```
255
311
256
-
Some sub-properties are available to manage the generating of the annotations targeted at building the document id using the field value, and their parameters (detailed in the annotation's documentation).
257
-
*`idPrefix` for the [`IdPrefix`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/mapping/id/IdPrefix.html)
258
-
annotation.
259
-
*`idAttribute` for the [`IdAttribute`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/mapping/id/IdAttribute.html)
260
-
annotation.
261
-
*`idSuffix` for the [`IdSuffix`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/mapping/id/IdSuffix.html)
262
-
annotation.
312
+
#### Use field for id generation
313
+
314
+
An `idPrefix` sub-property is available to manage the the [`IdAttribute`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/mapping/id/IdAttribute.html)
315
+
annotation and its parameters (detailed in the annotation's documentation).
263
316
264
317
E.g., this schema:
265
318
```json
@@ -271,7 +324,7 @@ E.g., this schema:
271
324
"title": "A field",
272
325
"type": "string",
273
326
"x-cb-field": {
274
-
"idPrefix": true
327
+
"idAttribute": true
275
328
}
276
329
},
277
330
"..."
@@ -281,7 +334,7 @@ E.g., this schema:
281
334
Will produce:
282
335
```java
283
336
@Field
284
-
@IdPrefix
337
+
@IdAttribute
285
338
privateString field;
286
339
```
287
340
And this schema:
@@ -310,6 +363,115 @@ Will produce:
310
363
privateString field;
311
364
```
312
365
366
+
### Non persisted fields for key generation
367
+
368
+
At property level, two JSON properties are available to use fields in code for key generation without persisting them,
369
+
via the following annotations and their parameters (detailed in the annotation's documentation).
370
+
*`x-cb-idPrefix` for the [`IdPrefix`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/mapping/id/IdPrefix.html)
371
+
annotation.
372
+
*`x-cb-id-suffix` for the [`IdSuffix`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/mapping/id/IdSuffix.html)
373
+
annotation.
374
+
375
+
E.g., this schema:
376
+
```json
377
+
{
378
+
"..."
379
+
"properties": {
380
+
"..."
381
+
"field": {
382
+
"title": "A field",
383
+
"type": "string",
384
+
"x-cb-idPrefix": true
385
+
},
386
+
"..."
387
+
}
388
+
}
389
+
```
390
+
Will produce:
391
+
```java
392
+
@IdPrefix
393
+
privateString field;
394
+
```
395
+
And this schema:
396
+
```json
397
+
{
398
+
"..."
399
+
"properties": {
400
+
"..."
401
+
"field": {
402
+
"title": "A field",
403
+
"type": "string",
404
+
"x-cb-idSuffix": {
405
+
"order": 1
406
+
}
407
+
},
408
+
"..."
409
+
}
410
+
}
411
+
```
412
+
Will produce:
413
+
```java
414
+
@Field
415
+
@IdSuffix(order=1)
416
+
privateString field;
417
+
```
418
+
419
+
#### Indexes
420
+
421
+
A sub-property `index` is available to declare indexes that will can be auto-generated by Spring
422
+
Data Couchbase via the [`QueryIndexed`](https://docs.spring.io/spring-data/couchbase/docs/current/api/org/springframework/data/couchbase/core/index/QueryIndexed.html)
423
+
annotation and its parameters (detailed in the annotation's documentation).
0 commit comments