I have a response payload that has a property named items. When I try creating a JSON Schema to validate the response payload with AJV I get the following warning strict mode: missing type "array" for keyword "items".
response-model.ts
const payloadItems = {
type: 'array',
items: {
type: 'object',
properties: {
a: {
type: 'string'
},
b: {
type: 'integer',
},
c: {
type: 'string'
}
}
}
} as const;
const responseSchema = {
allOf: [
{ ... },
{ items: payloadItems }
]
} as const;
I have also tried putting the payload items as a definition:
const responseSchema = {
$defs: {
payloadItems
},
allOf: [
{ ... },
{
items: {
$ref: '#/$defs/payloadItems'
}
},
]
} as const;
Is there a way to use the name items as a property in the response payload AND as a keyword in the JSON Schema without the above message?