Skip to content

Commit

Permalink
updated the expectedCaller yml to use x-expectedCaller instead of ove…
Browse files Browse the repository at this point in the history
…rloading the server property, updated the respec-oas.js table generation function to match
  • Loading branch information
Eric Schuh committed Jun 4, 2024
1 parent f5989ea commit bc2197c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 30 deletions.
5 changes: 5 additions & 0 deletions exchanges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ paths:
- zCap: []
operationId: createWorkflow
description: Creates a new workflow and returns workflowId in the response body.
x-expectedCaller: Administrators
requestBody:
content:
application/json:
Expand Down Expand Up @@ -53,6 +54,7 @@ paths:
- zCap: []
operationId: getWorkflowConfiguration
description: Gets the configuration of an existing workflow and returns it in the response body.
x-expectedCaller: Administrators
parameters:
- $ref: "./components/parameters/path/LocalWorkflowId.yml"
responses:
Expand All @@ -79,6 +81,7 @@ paths:
- zCap: []
operationId: createExchange
description: Creates a new exchange and returns exchangeId and time to live in the response body.
x-expectedCaller: Owner Coordinator
parameters:
- $ref: "./components/parameters/path/LocalWorkflowId.yml"
requestBody:
Expand Down Expand Up @@ -110,6 +113,7 @@ paths:
- zCap: []
operationId: getExchangeConfiguration
description: Gets the configuration of an existing exchange and returns it in the response body.
x-expectedCaller: Owner Coordinator
parameters:
- $ref: "./components/parameters/path/LocalWorkflowId.yml"
- $ref: "./components/parameters/path/LocalExchangeId.yml"
Expand All @@ -136,6 +140,7 @@ paths:
- zCap: []
operationId: participateInExchange
description: Participate in an exchange. Posting an empty body will start the exchange or return what the exchange is expecting to complete the next step.
x-expectedCaller: Anyone
parameters:
- $ref: "./components/parameters/path/LocalWorkflowId.yml"
- $ref: "./components/parameters/path/LocalExchangeId.yml"
Expand Down
16 changes: 8 additions & 8 deletions holder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ paths:
- oAuth2: []
- zCap: []
summary: Gets a credential or verifiable credential by ID. To get a credential that does not have credential.id set but has an associated credentialId value, pass credentialId instead.
servers: [{url: "Issuer Coordinator"}]
x-expectedCaller: "Issuer Coordinator"
operationId: getCredential
parameters:
- $ref: "./components/parameters/path/ObjectId.yml"
Expand Down Expand Up @@ -57,7 +57,7 @@ paths:
- oAuth2: []
- zCap: []
summary: Deletes a credential or verifiable credential by ID. To delete a credential that does not have credential.id set but has an associated credentialId value, pass credentialId instead.
servers: [{url: "Issuer Coordinator"}]
x-expectedCaller: "Issuer Coordinator"
operationId: deleteCredential
parameters:
- $ref: "./components/parameters/path/ObjectId.yml"
Expand Down Expand Up @@ -86,7 +86,7 @@ paths:
- zCap: []
summary: Gets list of credentials or verifiable credentials
operationId: getCredentials
servers: [{url: "Holder Coordinator or Issuer Coordinator"}]
x-expectedCaller: "Holder Coordinator or Issuer Coordinator"
parameters:
- in: query
name: type
Expand Down Expand Up @@ -128,7 +128,7 @@ paths:
summary: Derives a credential and returns it in the response body.
operationId: deriveCredential
description: Derives a credential and returns it in the response body.
servers: [{url: "Holder Coordinator"}]
x-expectedCaller: "Holder Coordinator"
requestBody:
content:
application/json:
Expand Down Expand Up @@ -159,7 +159,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: getPresentation
servers: [{url: "Holder Coordinator"}]
x-expectedCaller: "Holder Coordinator"
parameters:
- $ref: "./components/parameters/path/ObjectId.yml"
responses:
Expand Down Expand Up @@ -192,7 +192,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: deletePresentation
servers: [{url: "Holder Coordinator"}]
x-expectedCaller: "Holder Coordinator"
parameters:
- $ref: "./components/parameters/path/ObjectId.yml"
responses:
Expand Down Expand Up @@ -220,7 +220,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: getPresentations
servers: [{url: "Holder Coordinator"}]
x-expectedCaller: "Holder Coordinator"
parameters:
- in: query
name: type
Expand Down Expand Up @@ -260,7 +260,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: createPresentation
servers: [{url: "Holder Coordinator"}]
x-expectedCaller: "Holder Coordinator"
description: Creates a presentation and returns it in the response body.
requestBody:
content:
Expand Down
4 changes: 2 additions & 2 deletions issuer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: issueCredential
servers: [{url: "Issuer Coordinator"}]
x-expectedCaller: "Issuer Coordinator"
description: Issues a credential and returns it in the response body.
requestBody:
content:
Expand Down Expand Up @@ -55,7 +55,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: updateCredentialStatus
servers: [{url: "Verifier Service"}]
x-expectedCaller: "Verifier Service"
description: Updates the status of an issued credential.
requestBody:
content:
Expand Down
19 changes: 8 additions & 11 deletions respec-oas.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,15 @@ function buildComponentTables({config, document, apis}) {
for(const path of table.dataset.apiPath.split(/\s+/)) {
if(path.trim().length > 0) {
const endpoint = getEndpoint({apis, path});
for(const verb in endpoint) {
const {servers} = endpoint[verb];
const tableRow = document.createElement('tr');
var expectedCaller = "Expected Caller Undefined";
if(servers !== undefined)
{
expectedCaller = servers[0].url;
}
tableRow.innerHTML =
`<td>${verb.toUpperCase()}&nbsp;${path}</td><td>${expectedCaller}</td>`;
table.appendChild(tableRow);
const expectedCaller = endpoint['x-expectedCaller'];
const tableRow = document.createElement('tr');
if(expectedCaller === undefined)
{
expectedCaller = "Expected Caller Undefined";;
}
tableRow.innerHTML =
`<td>${verb.toUpperCase()}&nbsp;${path}</td><td>${expectedCaller}</td>`;
table.appendChild(tableRow);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions verifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: verifyCredential
servers: [{url: "Verification Coordinator"}]
x-expectedCaller: "Verification Coordinator"
description: Verifies a verifiableCredential and returns a verificationResult in the response body.
requestBody:
content:
Expand Down Expand Up @@ -52,7 +52,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: verifyPresentation
servers: [{url: "Verification Coordinator"}]
x-expectedCaller: "Verification Coordinator"
description: Verifies a verifiablePresentation and returns a verificationResult in the response body. Given the possibility of denial of service, buffer overflow, or other style attacks, an implementation is permitted to rate limit or restrict requests against this API endpoint to those requests that contain only a single credential with a 413 or 429 error code as appropriate.
requestBody:
content:
Expand Down Expand Up @@ -85,7 +85,7 @@ paths:
- oAuth2: []
- zCap: []
operationId: challenge
servers: [{url: "Verification Coordinator"}]
x-expectedCaller: "Verification Coordinator"
description: Creates a challenge to be used as `options.challenge` in future requests.
responses:
"200":
Expand Down
12 changes: 6 additions & 6 deletions versions/v0.0.2/vc-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ paths:
- Issuer
summary: Issues a credential and returns it in the response body.
operationId: issueCredential
servers: [{url:"Issuer Coordinator"}]
x-expectedCaller: "Issuer Coordinator"
description: Issues a credential and returns it in the response body.
requestBody:
content:
Expand All @@ -48,7 +48,7 @@ paths:
- Holder
summary: Derives a credential and returns it in the response body.
operationId: deriveCredential
servers: [{url:"Holder Coordinator"}]
x-expectedCaller: "Holder Coordinator"
description: Derives a credential and returns it in the response body.
requestBody:
content:
Expand All @@ -75,7 +75,7 @@ paths:
- Issuer
summary: Updates the status of an issued credential
operationId: updateCredentialStatus
servers: [{url:"Status Service"}]
x-expectedCaller: "Status Service"
description: Updates the status of an issued credential.
requestBody:
content:
Expand All @@ -98,7 +98,7 @@ paths:
- Holder
summary: Proves a presentation and returns it in the response body.
operationId: provePresentation
servers: [{url:"Holder Coordinator"}]
x-expectedCaller: "Holder Coordinator"
description: Proves a presentation and returns it in the response body.
requestBody:
content:
Expand All @@ -123,7 +123,7 @@ paths:
- Verifier
summary: Verifies a verifiableCredential and returns a verificationResult in the response body.
operationId: verifyCredential
servers: [{url:"Verification Coordinator"}]
x-expectedCaller: "Verification Coordinator"
description: Verifies a verifiableCredential and returns a verificationResult in the response body.
requestBody:
content:
Expand All @@ -148,7 +148,7 @@ paths:
- Verifier
summary: Verifies a Presentation with or without proofs attached and returns a verificationResult in the response body.
operationId: verifyPresentation
servers: [{url:"Verification Coordinator"}]
x-expectedCaller: "Verification Coordinator"
description: Verifies a verifiablePresentation and returns a verificationResult in the response body. Given the possibility of denial of service, buffer overflow, or other style attacks, an implementation is permitted to rate limit or restrict requests against this API endpoint to those requests that contain only a single credential with a 413 or 429 error code as appropriate.
requestBody:
content:
Expand Down

0 comments on commit bc2197c

Please sign in to comment.