-
Notifications
You must be signed in to change notification settings - Fork 3
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
docs: add swagger spec #6
Open
namhoang1604
wants to merge
2
commits into
next
Choose a base branch
from
docs/add-swagger-spec
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ report.json | |
dist | ||
coverage | ||
node_modules | ||
uploads | ||
uploads | ||
src/swagger/swagger.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"components": { | ||
"examples": { | ||
"ExampleRequest1": { | ||
"summary": "Verifiable Credential", | ||
"value": { | ||
"bucket": "verifiable-credentials", | ||
"id": "123e4567-e89b-12d3-a456-426614174000", | ||
"data": { | ||
"@context": [ | ||
"https://www.w3.org/ns/credentials/v2", | ||
"https://www.w3.org/ns/credentials/examples/v2" | ||
], | ||
"id": "http://example.gov/credentials/3732", | ||
"type": ["VerifiableCredential", "ExampleDegreeCredential"], | ||
"issuer": "did:example:6fb1f712ebe12c27cc26eebfe11", | ||
"validFrom": "2010-01-01T19:23:24Z", | ||
"credentialSubject": { | ||
"id": "https://subject.example/subject/3921", | ||
"degree": { | ||
"type": "ExampleBachelorDegree", | ||
"name": "Bachelor of Science and Arts" | ||
} | ||
}, | ||
"proof": { | ||
"type": "DataIntegrityProof", | ||
"cryptosuite": "eddsa-rdfc-2022", | ||
"created": "2021-11-13T18:19:39Z", | ||
"verificationMethod": "https://university.example/issuers/14#key-1", | ||
"proofPurpose": "assertionMethod", | ||
"proofValue": "z58DAdFfa9SkqZMVPxAQp...jQCrfFPP2oumHKtz" | ||
} | ||
} | ||
} | ||
}, | ||
"ExampleRequest2": { | ||
"summary": "Enveloped Verifiable Credential", | ||
"value": { | ||
"bucket": "verifiable-credentials", | ||
"id": "123e4567-e89b-12d3-a456-426614174001", | ||
"data": { | ||
"@context": [ | ||
"https://www.w3.org/ns/credentials/v2", | ||
"https://www.w3.org/ns/credentials/examples/v2" | ||
], | ||
"id": "data:application/vc+jwt,eyJraWQiOiJFeEhrQk1XOWZtYmt2VjI2Nm1ScHVQMnNVWV9OX0VXSU4xbGFwVXpPOHJvIiwiYWxnIjoiRVMyNTYifQ .eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvZXhhbXBsZXMvdjIiXSwiaWQiOiJodHRwOi8vdW5pdmVyc2l0eS5leGFtcGxlL2NyZWRlbnRpYWxzLzE4NzIiLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiRXhhbXBsZUFsdW1uaUNyZWRlbnRpYWwiXSwiaXNzdWVyIjoiaHR0cHM6Ly91bml2ZXJzaXR5LmV4YW1wbGUvaXNzdWVycy81NjUwNDkiLCJ2YWxpZEZyb20iOiIyMDEwLTAxLTAxVDE5OjIzOjI0WiIsImNyZWRlbnRpYWxTY2hlbWEiOnsiaWQiOiJodHRwczovL2V4YW1wbGUub3JnL2V4YW1wbGVzL2RlZ3JlZS5qc29uIiwidHlwZSI6Ikpzb25TY2hlbWEifSwiY3JlZGVudGlhbFN1YmplY3QiOnsiaWQiOiJkaWQ6ZXhhbXBsZToxMjMiLCJkZWdyZWUiOnsidHlwZSI6IkJhY2hlbG9yRGVncmVlIiwibmFtZSI6IkJhY2hlbG9yIG9mIFNjaWVuY2UgYW5kIEFydHMifX19 .vLtI6zKqEquVX-2RPhGyvHzQ9xdKOdFGRoFaEnG-UhQMGG7OGPi0WAoKPrj8OiT-LDcLMAUNKPncwPc8B-lqKg", | ||
"type": "EnvelopedVerifiableCredential" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"components": { | ||
"responses": { | ||
"400": { | ||
"description": "The request is invalid.", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"message": { | ||
"type": "string", | ||
"example": "Bucket is required. Please provide a bucket name." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"409": { | ||
"description": "The credential already exists.", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"message": { | ||
"type": "string", | ||
"example": "A credential with the provided ID already exists in the specified bucket." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"500": { | ||
"description": "An error occurred while storing the credential.", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"message": { | ||
"type": "string", | ||
"example": "An unexpected error occurred while storing the credential." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"components": { | ||
"schemas": { | ||
"Credential": { | ||
"type": "object", | ||
"properties": { | ||
"bucket": { | ||
"type": "string", | ||
"example": "verifiable-credentials" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"properties": { | ||
"field1": { | ||
"type": "string", | ||
"example": "value1" | ||
}, | ||
"field2": { | ||
"type": "string", | ||
"example": "value2" | ||
} | ||
} | ||
}, | ||
"id": { | ||
"type": "string", | ||
"format": "uuid", | ||
"example": "123e4567-e89b-12d3-a456-426614174000", | ||
"description": "Optional" | ||
} | ||
}, | ||
"required": ["bucket", "data"] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { PROTOCOL, DOMAIN, PORT, API_VERSION } from '../config'; | ||
|
||
export const updateSwagger = (swaggerJson: Record<string, any>) => { | ||
const swagger = { ...swaggerJson }; | ||
swagger.info = swagger.info || {}; | ||
swagger.info.version = API_VERSION; | ||
swagger.servers = [ | ||
{ | ||
url: `${PROTOCOL}://${DOMAIN}:${PORT}/${API_VERSION}`, | ||
}, | ||
]; | ||
return swagger; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Storage Service API" | ||
}, | ||
"servers": [], | ||
"paths": { | ||
"$ref": "./paths.json#/paths" | ||
}, | ||
"components": { | ||
"schemas": { | ||
"$ref": "./components/schemas.json#/components/schemas" | ||
}, | ||
"examples": { | ||
"$ref": "./components/examples.json#/components/examples" | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that this line is duplicated in the
README.md
. Could you consolidate it into a single, common sentence for the Swagger UI endpoint instead of duplicating it?