Reputation: 1237
I'm just getting started with creating my first OpenAPI definition (version 2.0), and I keep getting stuck on this error:
Invalid OpenAPI file. Please fix the schema errors:\n\"/parameters/categoryParam\": domain: validation; keyword: oneOf; message: instance does not match exactly one schema; matches: 0"
It's meant to simply be a query like "/cat/count", that would return an integer of how many cats there are - "cat" being the required path parameter. What exactly is wrong with my parameter definition here?
swagger: '2.0'
info:
description: "xxx"
title: "xxx"
version: "1.0.0"
host: "xxx"
consumes:
- "application/json"
produces:
- "application/json"
schemes:
- "https"
parameters:
categoryParam:
in: path
name: category
required: true
schema:
type: string
description: "xxx"
paths:
"/{category}/count":
get:
operationId: "get_category_count"
parameters:
- $ref: "#/parameters/categoryParam"
produces:
- application/json
responses:
'200':
description: "xxx"
schema:
$ref: '#/definitions/Model0'
definitions:
Model0:
properties:
count:
type: string
Upvotes: 1
Views: 2207
Reputation: 1237
Nevermind, dumb mistake. I needed to change:
schema:
type: string
to just:
type: string
Upvotes: 1