This pattern appears repeatedly (six times) in my project:
type: object
properties:
total:
type: integer
description: the count of all items that match the query
hits:
type: array
description: a single page of results
items:
$ref: '#/definitions/{various schema}'
The inner part of this repeated pattern ({various schema}) varies on each use. I'd like to reference shared code for each of these rather than repeating myself. I'd usually use $ref, but that doesn't seem to work here because of the variable bit.
I've tried to make anyOf work for me, but it only helps vary properties of an object, but I'm trying to vary items of an array.
Is there something I'm missing? Possibly a minor refactor to make this fit into a reusable pattern?