I’ve tried to spin up a mock API with OpenAPI spec. I’m struggling to debug why some requests return 500 rather than 200? Is this intended or am I missing something?
I have attached the openAPI file. Would really appreciate the help.
openapi: "3.0.0"
info:
version: 1.0.0
title: Example Mock
license:
name: MIT
servers:
- url: http://example.com
paths:
/auth/login:
post:
summary: Login and get a bearer token
description: |
In order to make a request you must first use the login endpoint to authorise requests. A bearertoken can
then be used to authorise any search requests made.
operationId: authLogin
tags:
- login
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/LoginRequest"
responses:
'200':
description: Dummy response
content:
application/json:
schema:
$ref: "#/components/schemas/LoginResponse"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/search/Address:
post:
summary: Address searching
operationId: searchAddress
tags:
- search
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/addressSearchRequest"
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/addressSearchResponse"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/search/DateOfBirth:
post:
summary: Date of birth verification
operationId: searchDateOfBirth
tags:
- search
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/dobSearchRequest"
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/dobSearchResponse"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/search/Sanction:
post:
summary: Sanction / PEP check
operationId: searchSanction
tags:
- search
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/sanctionSearchRequest"
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/sanctionSearchResponse"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/search/Insolvency:
post:
summary: Insolvency check
operationId: searchInsolvency
tags:
- search
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/insolvencySearchRequest"
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/insolvencySearchResponse"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/search/DeathScreen:
post:
summary: Death search
operationId: searchDeathScreen
tags:
- search
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/deathscreenSearchRequest"
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/deathscreenSearchResponse"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/search/CCJ:
post:
summary: CCJ check
operationId: searchCCJ
tags:
- search
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ccjSearchRequest"
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/ccjSearchResponse"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/search/CreditActive:
post:
summary: Credit information search
operationId: searchCreditActive
tags:
- search
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/creditactiveSearchRequest"
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/creditactiveSearchResponse"
'500':
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
LoginSuccess:
type: object
required:
- bearertoken
example: "dsad3432098df90sadsalknd=="
Address:
type: object
required:
- addressline1
- countrycode
example:
addressline1: "200"
addressline2: "Julius Road"
addressline3: "Bishopston"
addressline4: "South West"
addressline5: "Bristol"
postalcode: "BS7 8EU"
countrycode: "GB"
properties:
addressline1:
type: string
maxLength: 20
addressline2:
type: string
maxLength: 20
addressline3:
type: string
maxLength: 20
addressline4:
type: string
maxLength: 20
addressline5:
type: string
maxLength: 20
postalcode:
type: string
maxLength: 9
pattern: '^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9][A-Za-z]?))))\s?[0-9][A-Za-z]{2})$'
countrycode:
type: string
maxLength: 3
example: GB
dates:
type: array
items:
type: object
properties:
key:
type: string
value:
type: string
example:
key: "PeriodStart"
value: "2001-12-06"
addresses:
type: array
description: "Addresses found for subject"
items:
$ref: '#/components/schemas/Address'
Dob:
type: string
format: date
example: "1950-20-11"
property:
type: object
properties:
propertysale:
type: object
example:
date: "1975-01-01"
price: "£150,000"
silhouette: "D12"
type: ""
tenure: ""
properties:
date:
type: string
price:
type: string
silhouette:
type: string
type:
type: string
tenure:
type: string
insolvAddress:
type: object
example:
address1: "100"
address2: "JULIUS ROAD"
address3: "BRISTOL"
address4: ""
address5: ""
dps: ""
postcode: "B27 6BU"
properties:
address1:
type: string
address2:
type: string
address3:
type: string
address4:
type: string
address5:
type: string
dps:
type: string
postcode:
type: string
# Requests and responses
LoginRequest:
type: object
required:
- user
- password
example:
user: "testUser"
password: "testPassword"
properties:
user:
type: string
password:
type: string
LoginResponse:
type: object
example:
logintransactionid: "7basdhjdhsa82348"
bearertoken: "40DSAKjdsajh0934=="
expiryTime: 16594
properties:
logintransactionid:
type: string
bearertoken:
type: string
expiryTime:
type: integer
format: int32
addressSearchRequest:
type: object
required:
- firstname
- lastname
- dob
- addresses
example:
firstname: "JOHN"
lastname: "SMITH"
dob: "1990-11-01"
properties:
firstname:
type: string
lastname:
type: string
dob:
type: string
format: date
addresses:
$ref: "#/components/schemas/addresses"
addressSearchResponse:
type: object
example:
forenameappended: false
middlename: "Morgan"
telephone: "0123456789"
source: ""
recency: ""
forename: "John"
middlenameappended: false
phonematch: ""
goneaway: "N"
uklexid: 81293
surname: "SMITH"
matchtype: ""
addressvalidated: true
dobappended: false
occupants: ""
properties:
forenameappended:
type: boolean
middlename:
type: string
telephone:
type: string
source:
type: string
recency:
type: string
forename:
type: string
middlenameappended:
type: boolean
phonematch:
type: string
goneaway:
type: string
uklexid:
type: integer
format: int32
surname:
type: string
dob:
$ref: "#/components/schemas/Dob"
matchtype:
type: string
property:
$ref: "#/components/schemas/property"
addressvalidated:
type: boolean
dobappended:
type: boolean
occupants:
type: string
sanctionSearchRequest:
type: object
required:
- firstname
- lastname
- addresses
example:
firstname: "JOHN"
lastname: "SMITH"
properties:
firstname:
type: string
lastname:
type: string
addresses:
$ref: "#/components/schemas/addresses"
sanctionSearchResponse:
type: object
properties:
match:
type: array
items:
type: object
example:
country: "United Kingdom"
matchscore: 100
aliases: "Jonathan Smith"
dob: "1950-03-11"
name: "John Smith"
positions: "CEO"
source: "National:PEP:Family Member"
type: "PEP"
recency: ""
exceptions: ""
properties:
country:
type: string
description: "Country of the sanction location"
addresses:
$ref: "#/components/schemas/addresses"
matchscore:
type: integer
format: int32
description: "Indicates how closely the record matched the input information (maximum score of 100)."
maximum: 100
aliases:
type: string
description: "Possible other names subject is known by"
dob:
type: object
properties:
dob:
type: string
description: "Date of birth for this data source"
format: date
name:
type: string
description: "Name of subject from search result"
positions:
type: object
description: "Contains positions of subject in reference to political afiliations or businesses"
properties:
positions:
type: string
description: "Positions held for subject"
source:
type: string
description: "Source of data for match"
type:
type: string
description: "Kind of sanction. May contain how widely known subject is e.g. National"
recency:
type: string
description: "Recency of the data source providing sanction match"
format: date
exceptions:
type: string
description: "Exceptions from the request"
ccjSearchRequest:
type: object
required:
- firstname
- lastname
- dob
- addresses
example:
firstname: "JOHN"
lastname: "SMITH"
dob: "1990-11-01"
properties:
firstname:
type: string
lastname:
type: string
dob:
type: string
format: date
addresses:
$ref: "#/components/schemas/addresses"
ccjSearchResponse:
type: object
example:
amount: "£600.00"
address1: "200"
address2: "JULIIUS ROAD"
address3: "BRISTOL"
address4: ""
address5: ""
postcode: "BS7 8EU"
courtname: "BRISTOL COUNTY COURT"
dateend: "2021-11-20"
judgementdate: "2016-11-01"
casenumber: "CAE341CN"
uklexid: 321378
name: "JOHN SMITH"
judgementtype: "Satisfaction"
properties:
amount:
type: string
address3:
type: string
address2:
type: string
address1:
type: string
courtname:
type: string
postcode:
type: string
dateend:
type: string
format: date
judgementdate:
type: string
format: date
casenumber:
type: string
example:
uklexid:
type: integer
format: int32
dob:
$ref: "#/components/schemas/Dob"
name:
type: string
judgementtype:
type: string
address5:
type: string
address4:
type: string
dobSearchRequest:
type: object
required:
- firstname
- lastname
- dob
- addresses
example:
firstname: "JOHN"
lastname: "SMITH"
dob: "1990-11-01"
properties:
firstname:
type: string
lastname:
type: string
dob:
type: string
format: date
addresses:
$ref: "#/components/schemas/addresses"
dobSearchResponse:
type: object
properties:
experiandob:
type: integer
tracesmartdob:
type: integer
example:
experiandob: 0
tracesmartdob: 1
creditactiveSearchRequest:
type: object
required:
- firstname
- lastname
- addresses
example:
firstname: "JOHN"
lastname: "SMITH"
properties:
firstname:
type: string
lastname:
type: string
addresses:
$ref: "#/components/schemas/addresses"
creditactiveSearchResponse:
type: object
example:
insightaccounts: 0
insightlenders: 0
caislenders: 0
properties:
insightaccounts:
type: integer
insightlenders:
type: integer
caislenders:
type: integer
deathscreenSearchRequest:
type: object
description: "Request to send for a check on whether the person has a registered death"
required:
- firstname
- lastname
- addresses
example:
firstname: "JOHN"
lastname: "SMITH"
properties:
firstname:
type: string
lastname:
type: string
addresses:
$ref: "#/components/schemas/addresses"
deathscreenSearchResponse:
type: object
properties:
death:
type: object
example:
distno: ""
dor: ""
source: "DEATH REGISTRATION INFORMATION"
forename: "JOHN"
secondname: "ROBERT"
thirdname: ""
fourthname: ""
surname: "SMITH"
entryno: ""
uklexid: 1234567
volumeno: ""
matchtype: "NAME, ADDRESS AND DOB"
groreference: "TT12356789"
placeofbirth: "BRISTOL"
dob: "1930-10-01"
pageno: ""
district: ""
dod: "2000-05-01"
maidenname: "SMITHSON"
address1: "200"
address2: "JULIIUS ROAD"
address3: "BRISTOL"
address4: ""
address5: ""
postcode: "BS7 8EU"
properties:
distno:
type: string
dor:
type: string
source:
type: string
description: "Source of the data from this death"
forename:
type: string
description: "Forename of the deceased"
entryno:
type: string
uklexid:
type: integer
format: int32
thirdname:
type: string
surname:
type: string
description: "Surname of the deceased"
volumeno:
type: string
matchtype:
type: string
description: "Level of the match"
address5:
type: string
fourthname:
type: string
address4:
type: string
regno:
type: string
groreference:
type: string
address3:
type: string
address2:
type: string
address1:
type: string
postcode:
type: string
placeofbirth:
type: string
description: "Place of the deceased birth"
secondname:
type: string
dob:
type: string
description: "Subjects date of birth"
format: date
pageno:
type: string
district:
type: string
dod:
type: string
description: "Date of the death"
format: date
maidenname:
type: string
insolvencySearchRequest:
type: object
required:
- firstname
- lastname
- addresses
example:
firstname: "JOHN"
lastname: "SMITH"
properties:
firstname:
type: string
example: "JOHN"
lastname:
type: string
example: "SMITH"
addresses:
$ref: "#/components/schemas/addresses"
insolvencySearchResponse:
type: object
example:
occupation: "CONSTRUCTION"
aliases: "JONATHAN"
assettotal: ""
telephonenumber: "0123456789"
serviceoffice: "BRISTOL"
description: "JOHN SMITH TRADING AS SMITH CONSTRUCTION"
tradingnames: ""
court: "BRISTOL COUNTY COURT"
startdate: "2015-01-01"
type: "I"
debttotal: ""
caseno: 44022
uklexid: 1235672
name: "MR JOHN ROBERT SMITH"
presentationdate: "2015-01-02"
casetype: ""
status: "CURRENT"
properties:
address:
$ref: "#/components/schemas/insolvAddress"
occupation:
type: string
aliases:
type: string
assettotal:
type: string
telephonenumber:
type: string
serviceoffice:
type: string
description:
type: string
tradingnames:
type: string
court:
type: string
startdate:
type: string
format: date
type:
type: string
debttotal:
type: string
caseno:
type: integer
format: int32
uklexid:
type: integer
format: int32
dob:
$ref: "#/components/schemas/Dob"
name:
type: string
presentationdate:
type: string
format: date
casetype:
type: string
previousaddress:
$ref: "#/components/schemas/insolvAddress"
status:
type: string
Thanks