Skip to content

Commit

Permalink
feat(prism-agent): verification policies pagination. ATL-1334 (#205)
Browse files Browse the repository at this point in the history
* feat(prism-agent): implement BadRequest 400 response to be application/json
* feat(prism-agent): implement pagination for verification policy entities
* feat(prism-agent): update OAS with verification policies entities and endpoints
  • Loading branch information
yshyn-iohk committed Dec 6, 2022
1 parent 1802a9b commit 403eb38
Show file tree
Hide file tree
Showing 15 changed files with 748 additions and 165 deletions.
103 changes: 101 additions & 2 deletions prism-agent/service/api/http/pollux/schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@ components:
msg:
type: string

NotFoundResponse:
NotFound:
required:
- msg
type: object
properties:
msg:
type: string

BadRequest:
required:
- msg
type: object
properties:
msg:
type: string
errors:
type: array
items:
type: string

# Schema Registry

Expand Down Expand Up @@ -125,6 +137,93 @@ components:
items:
type: string

VerificationPolicy:
required:
- self
- kind
- id
- name
- createdAt
- updatedAt
type: object
properties:
self:
type: string
kind:
type: string
id:
type: string
name:
type: string
attributes:
type: array
items:
type: string
issuerDIDs:
type: array
items:
type: string
credentialTypes:
type: array
items:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time

VerificationPolicyInput:
required:
- name
type: object
properties:
id:
type: string
name:
type: string
attributes:
type: array
items:
type: string
issuerDIDs:
type: array
items:
type: string
credentialTypes:
type: array
items:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time

VerificationPolicyPage:
required:
- self
- kind
- pageOf
type: object
properties:
self:
type: string
kind:
type: string
pageOf:
type: string
next:
type: string
previous:
type: string
contents:
type: array
items:
$ref: '#/components/schemas/VerificationPolicy'

# Issue Credential Protocol

CreateIssueCredentialRecordRequest:
Expand Down Expand Up @@ -421,7 +520,7 @@ components:
type: string
description: "DID of the subject of the credential"
proof:
$ref: "#/components/schemas/W3CProof"
$ref: "#/components/schemas/Proof"

ErrorResponse:
type: object
Expand Down
222 changes: 221 additions & 1 deletion prism-agent/service/api/http/prism-agent-openapi-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ tags:
# Pollux
- name: Schema Registry
description: Schema Registry REST API
- name: Verification
description: Verification Policies REST API
- name: Present Proof
description: Present Proof REST API
# Connect
Expand Down Expand Up @@ -495,8 +497,226 @@ paths:
content:
application/json:
schema:
$ref: ./pollux/schemas.yaml#/components/schemas/NotFoundResponse
$ref: ./pollux/schemas.yaml#/components/schemas/NotFound

# ----------------------------------
# Verification Policies
# ----------------------------------
/verification/policies:
get:
tags:
- Verification
summary: Lookup verification policies by query
description: Lookup verification policies by `name`, `attributes`, `issuerDIDs`,
and `credentialTypes` and control the pagination by `offset` and `limit` parameters
operationId: lookupVerificationPoliciesByQuery
parameters:
- name: name
in: query
required: false
schema:
type: string
- name: attributes
in: query
required: false
schema:
type: string
- name: issuerDIDs
in: query
required: false
schema:
type: string
- name: credentialTypes
in: query
required: false
schema:
type: string
- name: offset
in: query
required: false
schema:
type: integer
format: int32
- name: limit
in: query
required: false
schema:
type: integer
format: int32
- name: order
in: query
required: false
schema:
type: string
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/VerificationPolicyPage'
'400':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/BadRequest'
'500':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/InternalServerError'
post:
tags:
- Verification
summary: Create the new verification policy
description: Create the new verification policy
operationId: createVerificationPolicy
requestBody:
description: Create verification policy object
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/VerificationPolicyInput'
required: true
responses:
'201':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/VerificationPolicy'
'400':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/BadRequest'
'500':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/InternalServerError'
/verification/policies/{id}:
get:
tags:
- Verification
summary: Fetch the verification policy by id
description: Get the verification policy by id
operationId: getVerificationPolicyById
parameters:
- name: id
in: path
description: Get the verification policy by id
required: true
schema:
type: string
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/VerificationPolicy'
'400':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/BadRequest'
'404':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/NotFound'
'500':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/InternalServerError'
put:
tags:
- Verification
summary: Update the verification policy object by id
description: 'Update the fields of the verification policy entry: `attributes`,
`issuerDIDs`, `name`, `credentialTypes`, '
operationId: updateVerificationPolicy
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
description: Update verification policy object
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/VerificationPolicyInput'
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/VerificationPolicy'
'400':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/BadRequest'
'404':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/NotFound'
'500':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/InternalServerError'
delete:
tags:
- Verification
summary: Delete the verification policy by id
description: Delete the verification policy by id
operationId: deleteVerificationPolicyById
parameters:
- name: id
in: path
description: Delete the verification policy by id
required: true
schema:
type: string
responses:
'200':
description: ''
'400':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/BadRequest'
'404':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/NotFound'
'500':
description: ''
content:
application/json:
schema:
$ref: './pollux/schemas.yaml#/components/schemas/InternalServerError'

## Issue Credential Protocol

Expand Down

0 comments on commit 403eb38

Please sign in to comment.