Skip to content

Commit 6298bdd

Browse files
committed
Improve OpenAPI generation
1 parent 1936615 commit 6298bdd

16 files changed

Lines changed: 167 additions & 278 deletions

openapi/openapi.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ components:
390390
RegistrarRequest:
391391
description: Input fields for a DID operation.
392392
type: object
393+
x-parent: true
393394
properties:
394395
jobId:
395396
description: This input field is used to keep track of an ongoing DID operation
@@ -593,7 +594,6 @@ components:
593594
additionalProperties: { }
594595
DidDocumentController:
595596
oneOf:
596-
- type: null
597597
- type: string
598598
- type: array
599599
items:
@@ -611,6 +611,7 @@ components:
611611
RegistrarState:
612612
description: The state after a DID operation.
613613
type: object
614+
x-parent: true
614615
required:
615616
- didState
616617
properties:
@@ -628,6 +629,7 @@ components:
628629
RegistrarResourceState:
629630
description: The state after a DID URL operation.
630631
type: object
632+
x-parent: true
631633
required:
632634
- didUrlState
633635
properties:
@@ -688,6 +690,7 @@ components:
688690
DidState:
689691
description: The current state of a DID.
690692
type: object
693+
x-parent: true
691694
required:
692695
- state
693696
discriminator:
@@ -712,6 +715,7 @@ components:
712715
DidUrlState:
713716
description: The current state of a DID URL and associated resource.
714717
type: object
718+
x-parent: true
715719
required:
716720
- state
717721
discriminator:
@@ -815,6 +819,7 @@ components:
815819
Secret:
816820
description: Secrets in requests and states.
817821
type: object
822+
x-parent: true
818823
properties:
819824
verificationMethod:
820825
$ref: "#/components/schemas/SecretVerificationMethod"
@@ -953,6 +958,7 @@ components:
953958
$ref: "#/components/schemas/DecryptionResponse"
954959
VerificationMethodData:
955960
type: object
961+
x-parent: true
956962
required:
957963
- type
958964
properties:

pom.xml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@
7575

7676
<!-- Plugin Versions -->
7777

78-
<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>
79-
<maven-clean-plugin.version>3.3.2</maven-clean-plugin.version>
80-
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
81-
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
82-
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
83-
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
84-
<maven-install-plugin.version>3.1.1</maven-install-plugin.version>
85-
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
86-
<maven-release-plugin.version>3.0.1</maven-release-plugin.version>
87-
<maven-patch-plugin.version>1.2</maven-patch-plugin.version>
78+
<maven-enforcer-plugin.version>3.6.2</maven-enforcer-plugin.version>
79+
<maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
80+
<maven-source-plugin.version>3.4.0</maven-source-plugin.version>
81+
<maven-resources-plugin.version>3.4.0</maven-resources-plugin.version>
82+
<maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
83+
<maven-surefire-plugin.version>3.5.4</maven-surefire-plugin.version>
84+
<maven-install-plugin.version>3.1.4</maven-install-plugin.version>
85+
<maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
86+
<maven-release-plugin.version>3.3.1</maven-release-plugin.version>
87+
<maven-patch-plugin.version>1.3</maven-patch-plugin.version>
8888

8989
<!-- Testing Versions -->
9090

@@ -107,7 +107,7 @@
107107

108108
<!-- OpenAPI Versions -->
109109

110-
<openapi-generator.version>7.4.0</openapi-generator.version>
110+
<openapi-generator.version>7.18.0</openapi-generator.version>
111111
<jakarta-annotation.version>3.0.0</jakarta-annotation.version>
112112
<jakarta-validation.version>3.1.1</jakarta-validation.version>
113113

@@ -198,7 +198,7 @@
198198
<artifactId>maven-compiler-plugin</artifactId>
199199
<configuration>
200200
<release>${java.version}</release>
201-
<forceJavacCompilerUse>true</forceJavacCompilerUse>
201+
<forceLegacyJavacApi>true</forceLegacyJavacApi>
202202
</configuration>
203203
</plugin>
204204
<plugin>
@@ -222,7 +222,7 @@
222222
<configuration>
223223
<rules>
224224
<requireMavenVersion>
225-
<version>3.2.5</version>
225+
<version>3.6.3</version>
226226
</requireMavenVersion>
227227
</rules>
228228
<fail>true</fail>

uni-registrar-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
<apiPackage>uniregistrar.openapi.api</apiPackage>
4949
<modelPackage>uniregistrar.openapi.model</modelPackage>
5050
<invokerPackage>uniregistrar.openapi</invokerPackage>
51-
<openapiNormalizer>REF_AS_PARENT_IN_ALLOF=true</openapiNormalizer>
5251
<configOptions>
5352
<basePackage>uniregistrar</basePackage>
5453
<sourceFolder>src/main/java/</sourceFolder>
@@ -58,6 +57,7 @@
5857
<configPackage>uniregistrar.openapi.config</configPackage>
5958
<asyncNative>false</asyncNative>
6059
<disallowAdditionalPropertiesIfNotPresent>false</disallowAdditionalPropertiesIfNotPresent>
60+
<legacyDiscriminatorBehavior>false</legacyDiscriminatorBehavior>
6161
<library>native</library>
6262
<useBeanValidation>true</useBeanValidation>
6363
<dateLibrary>java8</dateLibrary>

uni-registrar-core/src/main/patches/DecryptionRequest.java.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

uni-registrar-core/src/main/patches/DecryptionResponse.java.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

uni-registrar-core/src/main/patches/DidDocument.java.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
--- src/main/java/uniregistrar/openapi/model/DidDocumentController.java 2026-01-19 13:55:05.276890450 +0100
2+
+++ src/main/java/uniregistrar/openapi/model/DidDocumentController.java.changed 2026-01-19 13:53:22.947007764 +0100
3+
@@ -94,17 +94,17 @@
4+
try {
5+
boolean attemptParsing = true;
6+
// ensure that we respect type coercion as set on the client ObjectMapper
7+
- if (List<String>.class.equals(Integer.class) || List<String>.class.equals(Long.class) || List<String>.class.equals(Float.class) || List<String>.class.equals(Double.class) || List<String>.class.equals(Boolean.class) || List<String>.class.equals(String.class)) {
8+
+ if (List.class.equals(Integer.class) || List.class.equals(Long.class) || List.class.equals(Float.class) || List.class.equals(Double.class) || List.class.equals(Boolean.class) || List.class.equals(String.class)) {
9+
attemptParsing = typeCoercion;
10+
if (!attemptParsing) {
11+
- attemptParsing |= ((List<String>.class.equals(Integer.class) || List<String>.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
12+
- attemptParsing |= ((List<String>.class.equals(Float.class) || List<String>.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
13+
- attemptParsing |= (List<String>.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
14+
- attemptParsing |= (List<String>.class.equals(String.class) && token == JsonToken.VALUE_STRING);
15+
+ attemptParsing |= ((List.class.equals(Integer.class) || List.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT);
16+
+ attemptParsing |= ((List.class.equals(Float.class) || List.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT);
17+
+ attemptParsing |= (List.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
18+
+ attemptParsing |= (List.class.equals(String.class) && token == JsonToken.VALUE_STRING);
19+
}
20+
}
21+
if (attemptParsing) {
22+
- deserialized = tree.traverse(jp.getCodec()).readValueAs(List<String>.class);
23+
+ deserialized = tree.traverse(jp.getCodec()).readValueAs(List.class);
24+
// TODO: there is no validation against JSON schema constraints
25+
// (min, max, enum, pattern...), this does not perform a strict JSON
26+
// validation, which means the 'match' count may be higher than it should be.
27+
@@ -232,7 +232,7 @@
28+
}
29+
30+
static {
31+
- schemas.put("List<String>", List<String>.class);
32+
+ schemas.put("List<String>", List.class);
33+
schemas.put("String", String.class);
34+
JSON.registerDescendants(DidDocumentController.class, Collections.unmodifiableMap(schemas));
35+
}
36+
@@ -252,7 +252,7 @@
37+
*/
38+
@Override
39+
public void setActualInstance(Object instance) {
40+
- if (JSON.isInstanceOf(List<String>.class, instance, new HashSet<Class<?>>())) {
41+
+ if (JSON.isInstanceOf(List.class, instance, new HashSet<Class<?>>())) {
42+
super.setActualInstance(instance);
43+
return;
44+
}
45+
@@ -283,7 +283,7 @@
46+
* @return The actual instance of `List<String>`
47+
* @throws ClassCastException if the instance is not `List<String>`
48+
*/
49+
- public List<String> getList<String>() throws ClassCastException {
50+
+ public List<String> getList() throws ClassCastException {
51+
return (List<String>)super.getActualInstance();
52+
}
53+
54+
@@ -338,12 +338,12 @@
55+
}
56+
return joiner.toString();
57+
}
58+
- if (getActualInstance() instanceof List<String>) {
59+
+ if (getActualInstance() instanceof List) {
60+
if (getActualInstance() != null) {
61+
for (int i = 0; i < ((List<String>)getActualInstance()).size(); i++) {
62+
joiner.add(String.format(java.util.Locale.ROOT, "%sone_of_1%s%s=%s", prefix, suffix,
63+
"".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix),
64+
- ApiClient.urlEncode(String.valueOf(getActualInstance().get(i)))));
65+
+ ApiClient.urlEncode(String.valueOf(((List<String>)getActualInstance()).get(i)))));
66+
}
67+
}
68+
return joiner.toString();

uni-registrar-core/src/main/patches/DidState.java.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

uni-registrar-core/src/main/patches/DidUrlState.java.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

uni-registrar-core/src/main/patches/RequestOptions.java.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)