Skip to content

Commit

Permalink
Update swagger-jsdoc comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulla-ashurov committed Jul 10, 2023
1 parent 2d35520 commit 042f5f7
Show file tree
Hide file tree
Showing 8 changed files with 887 additions and 858 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
},
"scripts": {
"prebuild": "swagger-jsdoc -d src/swagger.cjs -o src/static/swagger.json ./src/controllers/*.ts",
"prebuild": "swagger-jsdoc -d src/swagger.cjs -o src/static/swagger.json ./src/controllers/*.ts ./src/types/swagger-types.ts",
"build": "tsc",
"start": "node dist/index.js",
"format": "prettier --write '*.{json,js}' 'src/**/*.{js,ts}' 'test/**/*.{js,ts}'",
Expand Down
209 changes: 0 additions & 209 deletions src/controllers/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,216 +6,7 @@ import { check, query, validationResult } from 'express-validator'
import { Credentials } from '../services/credentials.js'
import { Identity } from '../services/identity/index.js'

/**
* @openapi
*
* components:
* schemas:
* CredentialRequest:
* description: Input fields for the create operation.
* type: object
* additionalProperties: false
* properties:
* issuerDid:
* description: This input field is the Issuer's DID.
* type: string
* example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0
* subjectDid:
* description: This input field is the holder's DID.
* type: string
* example: did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
* attributes:
* description: Json input of the attributes.
* type: object
* example:
* gender: male
* name: bob
* '@context':
* description: Additional contexts to be included in the credential.
* type: array
* items:
* type: string
* example:
* - https://schema.org
* type:
* description: Additional type property to be included in the credential.
* type: array
* items:
* type: string
* example:
* - Person
* expirationDate:
* description: Optional expiration date according to the https://www.w3.org/TR/vc-data-model/#expiration specification.
* format:
* description: Select one of the supported credential formats, jwt by default.
* type: string
* enum:
* - jwt
* - lds
* example: jwt
* credentialStatus:
* description: Optional field to support revocation or suspension, which takes statusListName and statusListPurpose as inputs.
* type: object
* required:
* - statusPurpose
* - statusListName
* properties:
* statusPurpose:
* type: string
* enum:
* - revocation
* - suspension
* example: revocation
* statusListName:
* type: string
* example: employee-credentials
* statusListIndex:
* type: number
* example: 10
* statusListVersion:
* type: string
* statusListRangeStart:
* type: number
* statusListRangeEnd:
* type: number
* indexNotIn:
* type: number
* required: [issuerDid, subjectDid, attributes]
* Credential:
* description: Input fields for the update operation.
* type: object
* additionalProperties: false
* properties:
* '@context':
* type: array
* items:
* type: string
* example:
* - https://www.w3.org/2018/credentials/v1
* - https://schema.org
* - https://veramo.io/contexts/profile/v1
* type:
* type: array
* items:
* type: string
* example:
* - VerifiableCredential
* - Person
* expirationDate:
* type: string
* issuer:
* type: object
* properties:
* id:
* type: string
* example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0
* credentialSubject:
* type: object
* properties:
* id:
* type: string
* example:
* gender: male
* id: did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
* name: Bob
* credentialStatus:
* type: object
* properties:
* id:
* type: string
* example: https://resolver.cheqd.net/1.0/identifiers/did:cheqd:testnet:7c2b990c-3d05-4ebf-91af-f4f4d0091d2e?resourceName=cheqd-suspension-1&resourceType=StatusList2021Suspension#20
* statusListIndex:
* type: string
* example: 20
* statusPurpose:
* type: string
* enum:
* - revocation
* - suspension
* example: suspension
* type:
* type: string
* enum:
* - StatusList2021Entry
* example: StatusList2021Entry
* issuanceDate:
* type: string
* example: 2023-06-08T13:49:28.000Z
* proof:
* type: object
* properties:
* type:
* type: string
* example: JwtProof2020
* jwt:
* type: string
* example: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkaWQ6Y2hlcWQ6dGVzdG5ldDo3YmY4MWEyMC02MzNjLTRjYzctYmM0YS01YTQ1ODAxMDA1ZTAiLCJuYmYiOjE2ODYyMzIxNjgsInN1YiI6ImRpZDprZXk6ejZNa2hhWGdCWkR2b3REa0w1MjU3ZmFpenRpR2lDMlF0S0xHcGJubkVHdGEyZG9LIiwidmMiOnsiQGNvbnRleHQiOlsiaHR0cHM6Ly93d3cudzMub3JnLzIwMTgvY3JlZGVudGlhbHMvdjEiLCJodHRwczovL3NjaGVtYS5vcmciLCJodHRwczovL3ZlcmFtby5pby9jb250ZXh0cy9wcm9maWxlL3YxIl0sImNyZWRlbnRpYWxTdWJqZWN0Ijp7ImdlbmRlciI6Im1hbGUiLCJuYW1lIjoiQm9iIn0sInR5cGUiOlsiVmVyaWZpYWJsZUNyZWRlbnRpYWwiLCJQZXJzb24iXX19.wMfdR6RtyAZA4eoWya5Aw97wwER2Cm5Guk780Xw8H9fA3sfudIJeLRLboqixpTchqSbYeA7KbuCTAnLgXTD_Cg
* CredentialRevokeRequest:
* type: object
* properties:
* credential:
* description: This input field takes the credential object or the JWT string
* oneOf:
* - type: object
* - type: string
* RevocationResult:
* properties:
* revoked:
* type: boolean
* SuspensionResult:
* properties:
* suspended:
* type: boolean
* statusList:
* type: string
* UnSuspensionResult:
* properties:
* unsuspended:
* type: boolean
* statusList:
* type: string
* CredentialVerifyRequest:
* type: object
* properties:
* credential:
* description: This input field takes the credential object or the JWT string.\
* allOf:
* - type: object
* - type: string
* IVerifyResult:
* type: object
* properties:
* verified:
* type: boolean
* example: true
* issuer:
* type: string
* example: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0
* signer:
* type: object
* example:
* controller: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0
* id: did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1
* publicKeyBase58: BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt
* type: Ed25519VerificationKey2018
* jwt:
* type: string
* verifiableCredential:
* type: object
* PresentationRequest:
* type: object
* required:
* - presentation
* properties:
* presentation:
* description: This input field takes the presentation object or the JWT string.
* allOf:
* - type: string
* - type: object
*/

export class CredentialController {

public static issueValidator = [
check(['subjectDid', 'issuerDid'])
.exists().withMessage('DID is required')
Expand Down
38 changes: 0 additions & 38 deletions src/controllers/customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,6 @@ import type { Request, Response } from 'express'
import { CustomerService } from '../services/customer.js'
import { LogToHelper } from '../middleware/auth/logto.js'

/**
* @openapi
*
* tags:
* name: Account
*/

/**
* @openapi
*
* components:
* securitySchemes:
* bearerAuth:
* type: http
* scheme: bearer
* bearerFormat: JWT
* schemas:
* Customer:
* type: object
* properties:
* customerId:
* type: string
* address:
* type: string
* InvalidRequest:
* type: object
* properties:
* error:
* type: string
* UnauthorizedError:
* description: Access token is missing or invalid
* type: object
* properties:
* error:
* type: string
* example: Unauthorized Error
*/

export class CustomerController {

/**
Expand Down
Loading

0 comments on commit 042f5f7

Please sign in to comment.