-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
We have a schema like:
# openapi.yaml
openapi: "3.0.2"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
get:
summary: Info for a specific pet
operationId: listPets
tags:
- pets
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
type: object
required: [pets]
properties:
pets:
type: array
items:
$ref: './schema/pet.yaml'And:
# schema/pet.yaml
type: object
required: [id, name]
properties:
id:
type: string
format: uuid
name:
type: string
metadata:
type: object
nullable: trueBut when our API returns the following:
{
"pets": [
{
"id": "{uuid}",
"name": "Rowdy",
"metadata": null
}
]
}We get the following error:
OpenapiFirst::ResponseInvalidError: Response body is invalid: value at `/pets/0/metadata` is not an object.I am expecting that nullable: true should make this schema valid in 3.0.2.
I managed to get it to pass in tests by manually passing JSONSchemer.openapi30 to meta_schema when schema.validate is called here.
But I think you probably want to instantiate it in either builder.rb or ref_resolver.rb. My hunch is that it isn't getting passed down correctly when resolving a $ref schema, but I can't quite figure out the right test to verify
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels