Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proof to schema for credentials intended for issuance #423

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions components/Credential.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ components:
{
"type": "BachelorDegree",
"name": "Bachelor of Science and Arts",
},
},
}
}
}
UnsecuredCredential:
type: object
description: A W3C Verifiable Credential without a proof.
description: A W3C Verifiable Credential intended for issuance.
properties:
"@context":
type: array
Expand All @@ -89,6 +89,14 @@ components:
"credentialSubject":
type: object
description: The subject
"proof":
type: object
description: An optional proof for credentials that are secured using proof sets or chains.
oneOf:
- type: object
- type: array
items:
type: object
example:
{
"@context":
Expand All @@ -107,6 +115,6 @@ components:
{
"type": "BachelorDegree",
"name": "Bachelor of Science and Arts",
},
},
}
}
}
9 changes: 7 additions & 2 deletions respec-oas.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,16 @@ function renderJsonSchemaObject(schema) {
} else if(schema.oneOf) {
objectRendering += ' either ';
let itemCount = 0;
for(item of schema.oneOf) {
for(const item of schema.oneOf) {
if(item.type === 'string') {
objectRendering += 'a string';
} else if(item.type === 'object') {
objectRendering += renderJsonSchemaObject(item);
} else if(item.type === 'array') {
objectRendering += 'an array';
if(item.items) {
objectRendering += ` of ${item.items.type}(s)`;
}
}

itemCount += 1;
Expand All @@ -307,7 +312,7 @@ function renderJsonSchemaObject(schema) {
}
} else {
objectRendering += 'an object of the following form: <dl>';
for(property in schema.properties) {
for(const property in schema.properties) {
const value = schema.properties[property];
objectRendering += renderJsonSchemaProperty(property, value);
}
Expand Down