Skip to content

Commit 2d4a0a4

Browse files
committed
Revert "Remove OpenAPI (now found in W3C DID Resolution spec)"
This reverts commit b86d38c.
1 parent c64b46c commit 2d4a0a4

File tree

5 files changed

+327
-1
lines changed

5 files changed

+327
-1
lines changed

docs/driver-development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Your driver will be invoked via an HTTP GET call to:
1616

1717
Your driver will receive an `Accept` header with the value `application/ld+json`, and it should return either a valid [DID Document](https://w3c.github.io/did-resolution/#output-diddocument) or a [DID Resolution Result](https://w3c.github.io/did-resolution/#did-resolution-result) in the HTTP body. Your driver should also return an appropriate value in the `Content-Type` header, such as `application/did`.
1818

19-
An OpenAPI definition for DID Resolution is available [here](https://github.com/decentralized-identity/universal-resolver/blob/main/openapi/openapi.yaml).
19+
A Swagger API definition is available [here](https://github.com/decentralized-identity/universal-resolver/blob/main/openapi/openapi.yaml).
2020

2121
For more information about this interface, see the [DID Resolution](https://w3c.github.io/did-resolution/) specification.
2222

openapi/openapi.yaml

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
openapi: 3.1.0
2+
servers:
3+
- url: "/1.0/"
4+
info:
5+
title: Universal Resolver
6+
description: Universal Resolver
7+
version: 1.0.1
8+
contact:
9+
name: Decentralized Identity Foundation
10+
email: markus@danubetech.com
11+
paths:
12+
"/identifiers/{identifier}":
13+
get:
14+
summary: Resolve a DID / Dereference a DID URL
15+
description: <p>This endpoint resolves a DID or dereferences a DID URL. As input it takes the
16+
DID or DID URL, plus resolution options or dereferencing options.
17+
The output is a DID document plus
18+
metadata. The same endpoint can also be used to dereference a DID URL. In
19+
this case, the output is a DID document, or part of a DID document, or some
20+
other resource identified by the DID URL.</p>
21+
<p>See the <a href="<a href="https://www.w3.org/TR/did-resolution/">DID
22+
Resolution</a> specification for additional details.</p>
23+
operationId: resolve
24+
tags:
25+
- Universal Resolver
26+
parameters:
27+
- in: path
28+
required: true
29+
name: identifier
30+
schema:
31+
type: string
32+
description: The DID to be resolved, or the DID URL to be dereferenced.
33+
examples:
34+
example1:
35+
value: did:indy:sovrin:builder:VbPQNHsvoLZdaNU7fTBeFx
36+
description: A DID using the `indy` method.
37+
example2:
38+
value: did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w
39+
description: A DID using the `ion` method.
40+
example3:
41+
value: did:ebsi:z25ZZFS7FweHsm9MX2Qvc6gc
42+
description: A DID using the `ebsi` method.
43+
example4:
44+
value: did:indy:sovrin:builder:VbPQNHsvoLZdaNU7fTBeFx#key-1
45+
description: A DID URL with a fragment.
46+
example5:
47+
value: did:ebsi:z25ZZFS7FweHsm9MX2Qvc6gc#keys-1
48+
description: A DID URL with a fragment.
49+
- in: header
50+
required: false
51+
name: Accept
52+
schema:
53+
type: string
54+
description: The requested media type of the DID document representation or
55+
DID resolution result.
56+
examples:
57+
application/did:
58+
value: application/did
59+
description: Media type of a DID document.
60+
application/did-resolution:
61+
value: application/did-resolution
62+
description: Media type of a DID resolution result.
63+
application/did-url-dereferencing:
64+
value: application/did-url-dereferencing
65+
description: Media type of a DID URL dereferencing result.
66+
- in: query
67+
name: options
68+
schema:
69+
type: object
70+
additionalProperties:
71+
type: string
72+
description: The options for resolving the DID or dereferencing the DID URL.
73+
style: form
74+
explode: true
75+
responses:
76+
"200":
77+
description: successfully resolved!
78+
content:
79+
application/did:
80+
schema:
81+
type: object
82+
description: The DID document.
83+
example:
84+
"@context": https://www.w3.org/ns/did/v1.1
85+
id: did:indy:sovrin:WRfXPg8dantKVubE3HX8pw
86+
verificationMethod:
87+
- id: did:indy:sovrin:WRfXPg8dantKVubE3HX8pw#key-1
88+
type: Ed25519VerificationKey2018
89+
publicKeyBase58: H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV
90+
application/did-resolution:
91+
schema:
92+
$ref: "#/components/schemas/ResolutionResult"
93+
application/did-url-dereferencing:
94+
schema:
95+
$ref: "#/components/schemas/DereferencingResult"
96+
"400":
97+
description: Invalid DID or DID URL.
98+
"404":
99+
description: DID or DID URL not found.
100+
"406":
101+
description: Representation not supported.
102+
"410":
103+
description: Successfully resolved, but DID is deactivated.
104+
content:
105+
application/did:
106+
schema:
107+
type: object
108+
description: The deactivated DID document.
109+
application/did-resolution:
110+
schema:
111+
$ref: "#/components/schemas/ResolutionResult"
112+
application/did-url-dereferencing:
113+
schema:
114+
$ref: "#/components/schemas/DereferencingResult"
115+
"500":
116+
description: Internal Error.
117+
"501":
118+
description: DID method not supported.
119+
"/properties":
120+
get:
121+
summary: Return a map of configuration properties
122+
description: <p>This endpoint returns a map of the configuration properties
123+
of the DID Resolver, including of its drivers.</p>
124+
operationId: universalResolverGetProperties
125+
tags:
126+
- Universal Resolver
127+
responses:
128+
"200":
129+
description: Success.
130+
content:
131+
application/did+json:
132+
schema:
133+
type: object
134+
description: A map of properties.
135+
example:
136+
indy:
137+
libIndyPath: "/lib"
138+
poolConfigs: "..."
139+
"/methods":
140+
get:
141+
summary: Return a list of supported DID methods
142+
description: <p>This endpoint returns a list of DID methods supported by the
143+
DID Resolver.</p>
144+
operationId: universalResolverGetMethods
145+
tags:
146+
- Universal Resolver
147+
responses:
148+
"200":
149+
description: Success.
150+
content:
151+
application/did+json:
152+
schema:
153+
type: array
154+
items:
155+
type: string
156+
description: The list of supported DID methods.
157+
example:
158+
- btcr
159+
- indy
160+
- v1
161+
- key
162+
"/testIdentifiers":
163+
get:
164+
summary: Return a map of test identifiers
165+
description: <p>This endpoint returns a map of test identifiers, grouped by
166+
DID method.</p>
167+
operationId: universalResolverGetTestIdentifiers
168+
tags:
169+
- Universal Resolver
170+
responses:
171+
"200":
172+
description: Success.
173+
content:
174+
application/did+json:
175+
schema:
176+
type: object
177+
description: A map of test identifiers, grouped by DID method.
178+
example:
179+
btcr:
180+
- did:btcr:xz35-jznz-q9yu-ply
181+
- did:btcr:xkrn-xz7q-qsye-28p
182+
indy:
183+
- did:indy:sovrin:WRfXPg8dantKVubE3HX8pw
184+
"/traits":
185+
get:
186+
summary: Return a map of DID traits
187+
description: <p>This endpoint returns a map of the DID traits of
188+
the DID methods supported by the DID Resolver.</p>
189+
operationId: universalResolverGetTraits
190+
tags:
191+
- Universal Resolver
192+
responses:
193+
"200":
194+
description: Success.
195+
content:
196+
application/did+json:
197+
schema:
198+
type: object
199+
description: A map of DID traits.
200+
example:
201+
indy:
202+
updatable: true
203+
deactivatable: true
204+
enumerable: true
205+
historyAvailable: true
206+
humanReadable: false
207+
components:
208+
schemas:
209+
ResolutionResult:
210+
description: The DID resolution result.
211+
type: object
212+
properties:
213+
didDocument:
214+
type: object
215+
didResolutionMetadata:
216+
type: object
217+
additionalProperties: { }
218+
didDocumentMetadata:
219+
type: object
220+
additionalProperties: { }
221+
DereferencingResult:
222+
description: The DID URL dereferencing result.
223+
type: object
224+
properties:
225+
content:
226+
type: object
227+
dereferencingMetadata:
228+
type: object
229+
additionalProperties: { }
230+
contentMetadata:
231+
type: object
232+
additionalProperties: { }

pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@
103103
<springframework.version>6.2.5</springframework.version>
104104
<fasterxml.jackson.version>2.18.3</fasterxml.jackson.version>
105105

106+
<!-- OpenAPI Versions -->
107+
108+
<openapi-generator.version>7.4.0</openapi-generator.version>
109+
<jakarta-annotation.version>3.0.0</jakarta-annotation.version>
110+
<jakarta-validation.version>3.1.1</jakarta-validation.version>
111+
106112
<!-- DIF Versions -->
107113

108114
<did-common-java.version>1.18.0</did-common-java.version>
@@ -161,6 +167,11 @@
161167
<artifactId>maven-release-plugin</artifactId>
162168
<version>${maven-release-plugin.version}</version>
163169
</plugin>
170+
<plugin>
171+
<groupId>org.openapitools</groupId>
172+
<artifactId>openapi-generator-maven-plugin</artifactId>
173+
<version>${openapi-generator.version}</version>
174+
</plugin>
164175
</plugins>
165176
</pluginManagement>
166177
<plugins>
@@ -395,6 +406,19 @@
395406
<version>${did-common-java.version}</version>
396407
</dependency>
397408

409+
<!-- OpenAPI Dependencies -->
410+
411+
<dependency>
412+
<groupId>jakarta.annotation</groupId>
413+
<artifactId>jakarta.annotation-api</artifactId>
414+
<version>${jakarta-annotation.version}</version>
415+
</dependency>
416+
<dependency>
417+
<groupId>jakarta.validation</groupId>
418+
<artifactId>jakarta.validation-api</artifactId>
419+
<version>${jakarta-validation.version}</version>
420+
</dependency>
421+
398422
<!-- Other Dependencies -->
399423

400424
<dependency>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*
22
!.gitignore
3+
!.openapi-generator-ignore

uni-resolver-core/pom.xml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,67 @@
1111
<version>0.36-SNAPSHOT</version>
1212
</parent>
1313

14+
<build>
15+
<plugins>
16+
<plugin>
17+
<groupId>org.apache.maven.plugins</groupId>
18+
<artifactId>maven-clean-plugin</artifactId>
19+
<configuration>
20+
<filesets>
21+
<fileset>
22+
<directory>${project.basedir}/openapi/java-client-generated/</directory>
23+
<includes>
24+
<include>**/*</include>
25+
</includes>
26+
<excludes>
27+
<exclude>.gitignore</exclude>
28+
<exclude>.openapi-generator-ignore</exclude>
29+
</excludes>
30+
<followSymlinks>false</followSymlinks>
31+
</fileset>
32+
</filesets>
33+
</configuration>
34+
</plugin>
35+
<plugin>
36+
<groupId>org.openapitools</groupId>
37+
<artifactId>openapi-generator-maven-plugin</artifactId>
38+
<executions>
39+
<execution>
40+
<id>execution-universal-resolver</id>
41+
<goals>
42+
<goal>generate</goal>
43+
</goals>
44+
<configuration>
45+
<generatorName>java</generatorName>
46+
<inputSpec>${project.parent.basedir}/openapi/openapi.yaml</inputSpec>
47+
<output>openapi/java-client-generated/</output>
48+
<apiPackage>uniresolver.openapi.api</apiPackage>
49+
<modelPackage>uniresolver.openapi.model</modelPackage>
50+
<invokerPackage>uniresolver.openapi</invokerPackage>
51+
<openapiNormalizer>REF_AS_PARENT_IN_ALLOF=true</openapiNormalizer>
52+
<configOptions>
53+
<basePackage>uniresolver</basePackage>
54+
<sourceFolder>src/main/java/</sourceFolder>
55+
<groupId>decentralized-identity</groupId>
56+
<artifactId>uniresolver-openapi</artifactId>
57+
<artifactVersion>${project.version}</artifactVersion>
58+
<configPackage>uniresolver.openapi.config</configPackage>
59+
<asyncNative>false</asyncNative>
60+
<disallowAdditionalPropertiesIfNotPresent>false</disallowAdditionalPropertiesIfNotPresent>
61+
<library>native</library>
62+
<useBeanValidation>true</useBeanValidation>
63+
<dateLibrary>java8</dateLibrary>
64+
<hideGenerationTimestamp>true</hideGenerationTimestamp>
65+
<openApiNullable>false</openApiNullable>
66+
<useJakartaEe>true</useJakartaEe>
67+
</configOptions>
68+
</configuration>
69+
</execution>
70+
</executions>
71+
</plugin>
72+
</plugins>
73+
</build>
74+
1475
<dependencies>
1576
<dependency>
1677
<groupId>decentralized-identity</groupId>
@@ -28,6 +89,14 @@
2889
<groupId>com.fasterxml.jackson.datatype</groupId>
2990
<artifactId>jackson-datatype-jsr310</artifactId>
3091
</dependency>
92+
<dependency>
93+
<groupId>jakarta.annotation</groupId>
94+
<artifactId>jakarta.annotation-api</artifactId>
95+
</dependency>
96+
<dependency>
97+
<groupId>jakarta.validation</groupId>
98+
<artifactId>jakarta.validation-api</artifactId>
99+
</dependency>
31100
<dependency>
32101
<groupId>org.apache.httpcomponents</groupId>
33102
<artifactId>httpcore</artifactId>

0 commit comments

Comments
 (0)