Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 40533c5

Browse files
authored
Java, adds code samples to schema docs (#320)
* Adds code storing type to example * Adds code samples to schema docs * Moves schema doc code sample into helper template * Updates schema docs * Updates code sample indentation * Removes code samples from inherited schemas * Uses newline break for custom list and map classes * Adds array items to schema code sample * Adds required properties to map example * Updates petstore java docs * Samples regen
1 parent d41a95e commit 40533c5

259 files changed

Lines changed: 8233 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ public static class AdditionalpropertiesAllowsASchemaWhichShouldValidate1<br>
1818
extends JsonSchema
1919

2020
A schema class that validates payloads
21+
22+
### Code Sample
23+
```
24+
import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags;
25+
import org.openapijsonschematools.client.configurations.SchemaConfiguration;
26+
import org.openapijsonschematools.client.exceptions.ValidationException;
27+
import org.openapijsonschematools.client.schemas.MapMaker;
28+
import org.openapijsonschematools.client.schemas.validation.FrozenList;
29+
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
30+
31+
import java.util.Arrays;
32+
import java.util.List;
33+
import java.util.AbstractMap;
34+
35+
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
36+
37+
// Map validation
38+
AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validatedPayload =
39+
AdditionalpropertiesAllowsASchemaWhichShouldValidate.AdditionalpropertiesAllowsASchemaWhichShouldValidate1.validate(
40+
MapMaker.makeMap(
41+
),
42+
configuration
43+
);
44+
```
45+
2146
### Field Summary
2247
| Modifier and Type | Field and Description |
2348
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesAreAllowedByDefault.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public static class AdditionalpropertiesAreAllowedByDefault1<br>
1717
extends JsonSchema
1818

1919
A schema class that validates payloads
20+
2021
### Field Summary
2122
| Modifier and Type | Field and Description |
2223
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesCanExistByItself.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@ public static class AdditionalpropertiesCanExistByItself1<br>
1616
extends JsonSchema
1717

1818
A schema class that validates payloads
19+
20+
### Code Sample
21+
```
22+
import org.openapijsonschematools.client.configurations.JsonSchemaKeywordFlags;
23+
import org.openapijsonschematools.client.configurations.SchemaConfiguration;
24+
import org.openapijsonschematools.client.exceptions.ValidationException;
25+
import org.openapijsonschematools.client.schemas.MapMaker;
26+
import org.openapijsonschematools.client.schemas.validation.FrozenList;
27+
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
28+
29+
import java.util.Arrays;
30+
import java.util.List;
31+
import java.util.AbstractMap;
32+
33+
static final SchemaConfiguration configuration = new SchemaConfiguration(JsonSchemaKeywordFlags.ofNone());
34+
35+
// Map validation
36+
AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItselfMap validatedPayload =
37+
AdditionalpropertiesCanExistByItself.AdditionalpropertiesCanExistByItself1.validate(
38+
MapMaker.makeMap(
39+
),
40+
configuration
41+
);
42+
```
43+
1944
### Field Summary
2045
| Modifier and Type | Field and Description |
2146
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public static class AdditionalpropertiesShouldNotLookInApplicators1<br>
1919
extends JsonSchema
2020

2121
A schema class that validates payloads
22+
2223
### Field Summary
2324
| Modifier and Type | Field and Description |
2425
| ----------------- | ---------------------- |
@@ -62,6 +63,7 @@ public static class Schema0<br>
6263
extends JsonSchema
6364

6465
A schema class that validates payloads
66+
6567
### Field Summary
6668
| Modifier and Type | Field and Description |
6769
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/Allof.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public static class Allof1<br>
2020
extends JsonSchema
2121

2222
A schema class that validates payloads
23+
2324
### Field Summary
2425
| Modifier and Type | Field and Description |
2526
| ----------------- | ---------------------- |
@@ -43,6 +44,7 @@ public static class Schema1<br>
4344
extends JsonSchema
4445

4546
A schema class that validates payloads
47+
4648
### Field Summary
4749
| Modifier and Type | Field and Description |
4850
| ----------------- | ---------------------- |
@@ -98,6 +100,7 @@ public static class Schema0<br>
98100
extends JsonSchema
99101

100102
A schema class that validates payloads
103+
101104
### Field Summary
102105
| Modifier and Type | Field and Description |
103106
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/AllofCombinedWithAnyofOneof.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public static class AllofCombinedWithAnyofOneof1<br>
1717
extends JsonSchema
1818

1919
A schema class that validates payloads
20+
2021
### Field Summary
2122
| Modifier and Type | Field and Description |
2223
| ----------------- | ---------------------- |
@@ -40,6 +41,7 @@ public static class Schema0<br>
4041
extends JsonSchema
4142

4243
A schema class that validates payloads
44+
4345
### Field Summary
4446
| Modifier and Type | Field and Description |
4547
| ----------------- | ---------------------- |
@@ -63,6 +65,7 @@ public static class Schema01<br>
6365
extends JsonSchema
6466

6567
A schema class that validates payloads
68+
6669
### Field Summary
6770
| Modifier and Type | Field and Description |
6871
| ----------------- | ---------------------- |
@@ -86,6 +89,7 @@ public static class Schema02<br>
8689
extends JsonSchema
8790

8891
A schema class that validates payloads
92+
8993
### Field Summary
9094
| Modifier and Type | Field and Description |
9195
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/AllofSimpleTypes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public static class AllofSimpleTypes1<br>
1616
extends JsonSchema
1717

1818
A schema class that validates payloads
19+
1920
### Field Summary
2021
| Modifier and Type | Field and Description |
2122
| ----------------- | ---------------------- |
@@ -39,6 +40,7 @@ public static class Schema1<br>
3940
extends JsonSchema
4041

4142
A schema class that validates payloads
43+
4244
### Field Summary
4345
| Modifier and Type | Field and Description |
4446
| ----------------- | ---------------------- |
@@ -62,6 +64,7 @@ public static class Schema0<br>
6264
extends JsonSchema
6365

6466
A schema class that validates payloads
67+
6568
### Field Summary
6669
| Modifier and Type | Field and Description |
6770
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/AllofWithBaseSchema.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public static class AllofWithBaseSchema1<br>
2222
extends JsonSchema
2323

2424
A schema class that validates payloads
25+
2526
### Field Summary
2627
| Modifier and Type | Field and Description |
2728
| ----------------- | ---------------------- |
@@ -77,6 +78,7 @@ public static class Schema1<br>
7778
extends JsonSchema
7879

7980
A schema class that validates payloads
81+
8082
### Field Summary
8183
| Modifier and Type | Field and Description |
8284
| ----------------- | ---------------------- |
@@ -132,6 +134,7 @@ public static class Schema0<br>
132134
extends JsonSchema
133135

134136
A schema class that validates payloads
137+
135138
### Field Summary
136139
| Modifier and Type | Field and Description |
137140
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/AllofWithOneEmptySchema.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public static class AllofWithOneEmptySchema1<br>
1515
extends JsonSchema
1616

1717
A schema class that validates payloads
18+
1819
### Field Summary
1920
| Modifier and Type | Field and Description |
2021
| ----------------- | ---------------------- |

samples/client/3_0_3_unit_test/java/docs/components/schemas/AllofWithTheFirstEmptySchema.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public static class AllofWithTheFirstEmptySchema1<br>
1616
extends JsonSchema
1717

1818
A schema class that validates payloads
19+
1920
### Field Summary
2021
| Modifier and Type | Field and Description |
2122
| ----------------- | ---------------------- |

0 commit comments

Comments
 (0)