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

Commit 658c2f1

Browse files
authored
Java, adds JsonSchema input map and list generics (#329)
* Adds ListIn and MapIn JsonSchema generic inputs * Updates schema creation templates with needed generics * Fixes java tests * Adds MapOutValueType generic * Adds new generic param in jsonscham java file only, not template * Partially adds new type in JsonSchema * Adds two extra generics to json schemas * Adds input types for JsonSchema * Fixes map schemas * Fixes custom list schemas * Updates anytype schemas * Fixes map method * Fixes list getListOutputInstance method * Fixes object schema tests * Regens both java samples * Adds NonCollectionJsonSchema * Adds NonCollectionJsonSchema * Samples updated * Sample regen with import fix
1 parent 4231bf0 commit 658c2f1

File tree

391 files changed

+1613
-1345
lines changed

Some content is hidden

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

391 files changed

+1613
-1345
lines changed

samples/client/3_0_3_unit_test/java/.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ src/main/java/org/openapijsonschematools/client/schemas/validation/MinLengthVali
226226
src/main/java/org/openapijsonschematools/client/schemas/validation/MinPropertiesValidator.java
227227
src/main/java/org/openapijsonschematools/client/schemas/validation/MinimumValidator.java
228228
src/main/java/org/openapijsonschematools/client/schemas/validation/MultipleOfValidator.java
229+
src/main/java/org/openapijsonschematools/client/schemas/validation/NonCollectionJsonSchema.java
229230
src/main/java/org/openapijsonschematools/client/schemas/validation/NotValidator.java
230231
src/main/java/org/openapijsonschematools/client/schemas/validation/OneOfValidator.java
231232
src/main/java/org/openapijsonschematools/client/schemas/validation/PathToSchemasMap.java

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAllowsASchemaWhichShouldValidate.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class AdditionalpropertiesAllowsASchemaWhichShouldValidateMapInput {
6565
}
6666

6767

68-
public static class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 extends JsonSchema<AdditionalpropertiesAllowsASchemaWhichShouldValidateMap, FrozenList> {
68+
public static class AdditionalpropertiesAllowsASchemaWhichShouldValidate1 extends JsonSchema<Object, Object, AdditionalpropertiesAllowsASchemaWhichShouldValidateMap, Object, Object, FrozenList<Object>> {
6969
/*
7070
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
7171
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
@@ -84,8 +84,8 @@ public AdditionalpropertiesAllowsASchemaWhichShouldValidate1() {
8484
}
8585

8686
@Override
87-
protected AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getMapOutputInstance(FrozenMap<?, ?> arg) {
88-
return new AdditionalpropertiesAllowsASchemaWhichShouldValidateMap((FrozenMap<String, Object>) arg);
87+
protected AdditionalpropertiesAllowsASchemaWhichShouldValidateMap getMapOutputInstance(FrozenMap<String, Object> arg) {
88+
return new AdditionalpropertiesAllowsASchemaWhichShouldValidateMap(arg);
8989
}
9090
public AdditionalpropertiesAllowsASchemaWhichShouldValidateMap validate(Map<String, Object> arg, SchemaConfiguration configuration) throws ValidationException {
9191
return validateMap(arg, configuration);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesAreAllowedByDefault.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class AdditionalpropertiesAreAllowedByDefaultMapInput {
6464
}
6565

6666

67-
public static class AdditionalpropertiesAreAllowedByDefault1 extends JsonSchema<AdditionalpropertiesAreAllowedByDefaultMap, FrozenList> {
67+
public static class AdditionalpropertiesAreAllowedByDefault1 extends JsonSchema<Object, Object, AdditionalpropertiesAreAllowedByDefaultMap, Object, Object, FrozenList> {
6868
/*
6969
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
7070
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
@@ -81,8 +81,8 @@ public AdditionalpropertiesAreAllowedByDefault1() {
8181
}
8282

8383
@Override
84-
protected AdditionalpropertiesAreAllowedByDefaultMap getMapOutputInstance(FrozenMap<?, ?> arg) {
85-
return new AdditionalpropertiesAreAllowedByDefaultMap((FrozenMap<String, Object>) arg);
84+
protected AdditionalpropertiesAreAllowedByDefaultMap getMapOutputInstance(FrozenMap<String, Object> arg) {
85+
return new AdditionalpropertiesAreAllowedByDefaultMap(arg);
8686
}
8787
public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException {
8888
return validateVoid(arg, configuration);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesCanExistByItself.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class AdditionalpropertiesCanExistByItselfMapInput {
4141
}
4242

4343

44-
public static class AdditionalpropertiesCanExistByItself1 extends JsonSchema<AdditionalpropertiesCanExistByItselfMap, FrozenList> {
44+
public static class AdditionalpropertiesCanExistByItself1 extends JsonSchema<Boolean, Boolean, AdditionalpropertiesCanExistByItselfMap, Object, Object, FrozenList<Object>> {
4545
/*
4646
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
4747
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
@@ -56,8 +56,8 @@ public AdditionalpropertiesCanExistByItself1() {
5656
}
5757

5858
@Override
59-
protected AdditionalpropertiesCanExistByItselfMap getMapOutputInstance(FrozenMap<?, ?> arg) {
60-
return new AdditionalpropertiesCanExistByItselfMap((FrozenMap<String, Boolean>) arg);
59+
protected AdditionalpropertiesCanExistByItselfMap getMapOutputInstance(FrozenMap<String, Boolean> arg) {
60+
return new AdditionalpropertiesCanExistByItselfMap(arg);
6161
}
6262
public AdditionalpropertiesCanExistByItselfMap validate(Map<String, Boolean> arg, SchemaConfiguration configuration) throws ValidationException {
6363
return validateMap(arg, configuration);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AdditionalpropertiesShouldNotLookInApplicators.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class Schema0MapInput {
6060
}
6161

6262

63-
public static class Schema0 extends JsonSchema<Schema0Map, FrozenList> {
63+
public static class Schema0 extends JsonSchema<Object, Object, Schema0Map, Object, Object, FrozenList> {
6464
public Schema0() {
6565
super(new LinkedHashMap<>(Map.ofEntries(
6666
new KeywordEntry("properties", new PropertiesValidator(Map.ofEntries(
@@ -70,8 +70,8 @@ public Schema0() {
7070
}
7171

7272
@Override
73-
protected Schema0Map getMapOutputInstance(FrozenMap<?, ?> arg) {
74-
return new Schema0Map((FrozenMap<String, Object>) arg);
73+
protected Schema0Map getMapOutputInstance(FrozenMap<String, Object> arg) {
74+
return new Schema0Map(arg);
7575
}
7676
public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException {
7777
return validateVoid(arg, configuration);
@@ -142,7 +142,7 @@ public class AdditionalpropertiesShouldNotLookInApplicatorsMapInput {
142142
}
143143

144144

145-
public static class AdditionalpropertiesShouldNotLookInApplicators1 extends JsonSchema<AdditionalpropertiesShouldNotLookInApplicatorsMap, FrozenList> {
145+
public static class AdditionalpropertiesShouldNotLookInApplicators1 extends JsonSchema<Boolean, Boolean, AdditionalpropertiesShouldNotLookInApplicatorsMap, Object, Object, FrozenList> {
146146
/*
147147
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
148148
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
@@ -159,8 +159,8 @@ public AdditionalpropertiesShouldNotLookInApplicators1() {
159159
}
160160

161161
@Override
162-
protected AdditionalpropertiesShouldNotLookInApplicatorsMap getMapOutputInstance(FrozenMap<?, ?> arg) {
163-
return new AdditionalpropertiesShouldNotLookInApplicatorsMap((FrozenMap<String, Boolean>) arg);
162+
protected AdditionalpropertiesShouldNotLookInApplicatorsMap getMapOutputInstance(FrozenMap<String, Boolean> arg) {
163+
return new AdditionalpropertiesShouldNotLookInApplicatorsMap(arg);
164164
}
165165
public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException {
166166
return validateVoid(arg, configuration);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/Allof.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory;
1818
import org.openapijsonschematools.client.schemas.validation.KeywordEntry;
1919
import org.openapijsonschematools.client.schemas.validation.KeywordValidator;
20+
import org.openapijsonschematools.client.schemas.validation.NonCollectionJsonSchema;
2021
import org.openapijsonschematools.client.schemas.validation.PropertiesValidator;
2122
import org.openapijsonschematools.client.schemas.validation.PropertyEntry;
2223
import org.openapijsonschematools.client.schemas.validation.RequiredValidator;
@@ -55,7 +56,7 @@ public class Schema0MapInput {
5556
}
5657

5758

58-
public static class Schema0 extends JsonSchema<Schema0Map, FrozenList> {
59+
public static class Schema0 extends JsonSchema<Object, Object, Schema0Map, Object, Object, FrozenList> {
5960
public Schema0() {
6061
super(new LinkedHashMap<>(Map.ofEntries(
6162
new KeywordEntry("properties", new PropertiesValidator(Map.ofEntries(
@@ -68,8 +69,8 @@ public Schema0() {
6869
}
6970

7071
@Override
71-
protected Schema0Map getMapOutputInstance(FrozenMap<?, ?> arg) {
72-
return new Schema0Map((FrozenMap<String, Object>) arg);
72+
protected Schema0Map getMapOutputInstance(FrozenMap<String, Object> arg) {
73+
return new Schema0Map(arg);
7374
}
7475
public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException {
7576
return validateVoid(arg, configuration);
@@ -150,7 +151,7 @@ public class Schema1MapInput {
150151
}
151152

152153

153-
public static class Schema1 extends JsonSchema<Schema1Map, FrozenList> {
154+
public static class Schema1 extends JsonSchema<Object, Object, Schema1Map, Object, Object, FrozenList> {
154155
public Schema1() {
155156
super(new LinkedHashMap<>(Map.ofEntries(
156157
new KeywordEntry("properties", new PropertiesValidator(Map.ofEntries(
@@ -163,8 +164,8 @@ public Schema1() {
163164
}
164165

165166
@Override
166-
protected Schema1Map getMapOutputInstance(FrozenMap<?, ?> arg) {
167-
return new Schema1Map((FrozenMap<String, Object>) arg);
167+
protected Schema1Map getMapOutputInstance(FrozenMap<String, Object> arg) {
168+
return new Schema1Map(arg);
168169
}
169170
public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException {
170171
return validateVoid(arg, configuration);
@@ -215,7 +216,7 @@ public FrozenList<Object> validate(List<Object> arg, SchemaConfiguration configu
215216
}
216217
}
217218

218-
public static class Allof1 extends JsonSchema<FrozenMap, FrozenList> {
219+
public static class Allof1 extends NonCollectionJsonSchema {
219220
/*
220221
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
221222
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofCombinedWithAnyofOneof.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
import org.openapijsonschematools.client.schemas.validation.AnyOfValidator;
1212
import org.openapijsonschematools.client.schemas.validation.FrozenList;
1313
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
14-
import org.openapijsonschematools.client.schemas.validation.JsonSchema;
1514
import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory;
1615
import org.openapijsonschematools.client.schemas.validation.KeywordEntry;
1716
import org.openapijsonschematools.client.schemas.validation.KeywordValidator;
1817
import org.openapijsonschematools.client.schemas.validation.MultipleOfValidator;
18+
import org.openapijsonschematools.client.schemas.validation.NonCollectionJsonSchema;
1919
import org.openapijsonschematools.client.schemas.validation.OneOfValidator;
2020

2121
public class AllofCombinedWithAnyofOneof {
2222
// nest classes so all schemas and input/output classes can be public
2323

2424

25-
public static class Schema02 extends JsonSchema<FrozenMap, FrozenList> {
25+
public static class Schema02 extends NonCollectionJsonSchema {
2626
public Schema02() {
2727
super(new LinkedHashMap<>(Map.ofEntries(
2828
new KeywordEntry("multipleOf", new MultipleOfValidator(2))
@@ -77,7 +77,7 @@ public FrozenList<Object> validate(List<Object> arg, SchemaConfiguration configu
7777
}
7878
}
7979

80-
public static class Schema01 extends JsonSchema<FrozenMap, FrozenList> {
80+
public static class Schema01 extends NonCollectionJsonSchema {
8181
public Schema01() {
8282
super(new LinkedHashMap<>(Map.ofEntries(
8383
new KeywordEntry("multipleOf", new MultipleOfValidator(3))
@@ -132,7 +132,7 @@ public FrozenList<Object> validate(List<Object> arg, SchemaConfiguration configu
132132
}
133133
}
134134

135-
public static class Schema0 extends JsonSchema<FrozenMap, FrozenList> {
135+
public static class Schema0 extends NonCollectionJsonSchema {
136136
public Schema0() {
137137
super(new LinkedHashMap<>(Map.ofEntries(
138138
new KeywordEntry("multipleOf", new MultipleOfValidator(5))
@@ -187,7 +187,7 @@ public FrozenList<Object> validate(List<Object> arg, SchemaConfiguration configu
187187
}
188188
}
189189

190-
public static class AllofCombinedWithAnyofOneof1 extends JsonSchema<FrozenMap, FrozenList> {
190+
public static class AllofCombinedWithAnyofOneof1 extends NonCollectionJsonSchema {
191191
/*
192192
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
193193
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofSimpleTypes.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
import org.openapijsonschematools.client.schemas.validation.AllOfValidator;
1111
import org.openapijsonschematools.client.schemas.validation.FrozenList;
1212
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
13-
import org.openapijsonschematools.client.schemas.validation.JsonSchema;
1413
import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory;
1514
import org.openapijsonschematools.client.schemas.validation.KeywordEntry;
1615
import org.openapijsonschematools.client.schemas.validation.KeywordValidator;
1716
import org.openapijsonschematools.client.schemas.validation.MaximumValidator;
1817
import org.openapijsonschematools.client.schemas.validation.MinimumValidator;
18+
import org.openapijsonschematools.client.schemas.validation.NonCollectionJsonSchema;
1919

2020
public class AllofSimpleTypes {
2121
// nest classes so all schemas and input/output classes can be public
2222

2323

24-
public static class Schema0 extends JsonSchema<FrozenMap, FrozenList> {
24+
public static class Schema0 extends NonCollectionJsonSchema {
2525
public Schema0() {
2626
super(new LinkedHashMap<>(Map.ofEntries(
2727
new KeywordEntry("maximum", new MaximumValidator(30))
@@ -76,7 +76,7 @@ public FrozenList<Object> validate(List<Object> arg, SchemaConfiguration configu
7676
}
7777
}
7878

79-
public static class Schema1 extends JsonSchema<FrozenMap, FrozenList> {
79+
public static class Schema1 extends NonCollectionJsonSchema {
8080
public Schema1() {
8181
super(new LinkedHashMap<>(Map.ofEntries(
8282
new KeywordEntry("minimum", new MinimumValidator(20))
@@ -131,7 +131,7 @@ public FrozenList<Object> validate(List<Object> arg, SchemaConfiguration configu
131131
}
132132
}
133133

134-
public static class AllofSimpleTypes1 extends JsonSchema<FrozenMap, FrozenList> {
134+
public static class AllofSimpleTypes1 extends NonCollectionJsonSchema {
135135
/*
136136
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
137137
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithBaseSchema.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class Schema0MapInput {
5656
}
5757

5858

59-
public static class Schema0 extends JsonSchema<Schema0Map, FrozenList> {
59+
public static class Schema0 extends JsonSchema<Object, Object, Schema0Map, Object, Object, FrozenList> {
6060
public Schema0() {
6161
super(new LinkedHashMap<>(Map.ofEntries(
6262
new KeywordEntry("properties", new PropertiesValidator(Map.ofEntries(
@@ -69,8 +69,8 @@ public Schema0() {
6969
}
7070

7171
@Override
72-
protected Schema0Map getMapOutputInstance(FrozenMap<?, ?> arg) {
73-
return new Schema0Map((FrozenMap<String, Object>) arg);
72+
protected Schema0Map getMapOutputInstance(FrozenMap<String, Object> arg) {
73+
return new Schema0Map(arg);
7474
}
7575
public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException {
7676
return validateVoid(arg, configuration);
@@ -151,7 +151,7 @@ public class Schema1MapInput {
151151
}
152152

153153

154-
public static class Schema1 extends JsonSchema<Schema1Map, FrozenList> {
154+
public static class Schema1 extends JsonSchema<Object, Object, Schema1Map, Object, Object, FrozenList> {
155155
public Schema1() {
156156
super(new LinkedHashMap<>(Map.ofEntries(
157157
new KeywordEntry("properties", new PropertiesValidator(Map.ofEntries(
@@ -164,8 +164,8 @@ public Schema1() {
164164
}
165165

166166
@Override
167-
protected Schema1Map getMapOutputInstance(FrozenMap<?, ?> arg) {
168-
return new Schema1Map((FrozenMap<String, Object>) arg);
167+
protected Schema1Map getMapOutputInstance(FrozenMap<String, Object> arg) {
168+
return new Schema1Map(arg);
169169
}
170170
public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException {
171171
return validateVoid(arg, configuration);
@@ -246,7 +246,7 @@ public class AllofWithBaseSchemaMapInput {
246246
}
247247

248248

249-
public static class AllofWithBaseSchema1 extends JsonSchema<AllofWithBaseSchemaMap, FrozenList> {
249+
public static class AllofWithBaseSchema1 extends JsonSchema<Object, Object, AllofWithBaseSchemaMap, Object, Object, FrozenList> {
250250
/*
251251
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
252252
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
@@ -269,8 +269,8 @@ public AllofWithBaseSchema1() {
269269
}
270270

271271
@Override
272-
protected AllofWithBaseSchemaMap getMapOutputInstance(FrozenMap<?, ?> arg) {
273-
return new AllofWithBaseSchemaMap((FrozenMap<String, Object>) arg);
272+
protected AllofWithBaseSchemaMap getMapOutputInstance(FrozenMap<String, Object> arg) {
273+
return new AllofWithBaseSchemaMap(arg);
274274
}
275275
public Void validate(Void arg, SchemaConfiguration configuration) throws ValidationException {
276276
return validateVoid(arg, configuration);

samples/client/3_0_3_unit_test/java/src/main/java/org/openapijsonschematools/client/components/schemas/AllofWithOneEmptySchema.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import org.openapijsonschematools.client.schemas.validation.AllOfValidator;
1212
import org.openapijsonschematools.client.schemas.validation.FrozenList;
1313
import org.openapijsonschematools.client.schemas.validation.FrozenMap;
14-
import org.openapijsonschematools.client.schemas.validation.JsonSchema;
1514
import org.openapijsonschematools.client.schemas.validation.JsonSchemaFactory;
1615
import org.openapijsonschematools.client.schemas.validation.KeywordEntry;
1716
import org.openapijsonschematools.client.schemas.validation.KeywordValidator;
17+
import org.openapijsonschematools.client.schemas.validation.NonCollectionJsonSchema;
1818

1919
public class AllofWithOneEmptySchema {
2020
// nest classes so all schemas and input/output classes can be public
@@ -23,7 +23,7 @@ public class AllofWithOneEmptySchema {
2323
public static class Schema0 extends AnyTypeJsonSchema {}
2424

2525

26-
public static class AllofWithOneEmptySchema1 extends JsonSchema<FrozenMap, FrozenList> {
26+
public static class AllofWithOneEmptySchema1 extends NonCollectionJsonSchema {
2727
/*
2828
NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
2929
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator

0 commit comments

Comments
 (0)