-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using readOnly and required fails #289
Comments
Could you tell me a little more about it?
|
This is a stripped down version of the schema (OpenAPI 3). ---
openapi: 3.0.0
info:
version: 1.0.0
title: Foobar API
description: ''
servers:
- url: https://api.example.com
description: ''
security: []
paths:
"/foobars":
get:
summary: Retrieves the foobars.
responses:
"200":
description: success
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Foobar"
"/foobars/{id}":
patch:
parameters:
- $ref: "#/components/parameters/id"
requestBody:
"$ref": "#/components/requestBodies/updateFoobar"
responses:
"204":
description: no content
components:
parameters:
id:
name: id
in: path
required: true
schema:
type: integer
description: The ID of the record.
readOnly: true
description: The ID of the record.
schemas:
Foobar:
type: object
properties:
type:
type: string
enum:
- foo
- bar
description: The type of the foobar.
readOnly: true
required:
- type
requestBodies:
updateFoobar:
content:
application/json:
schema:
type: object
properties:
foobar:
$ref: "#/components/schemas/Foobar" So, in this case, the So, the since the |
The committee doesn't support readOnly / writeOnly yet. 😢 |
Hi!
I have a schema where an attribute
type
is marked asreadOnly
. It cannot be set or updated but it is always returned.Now, to make Committee validate (in my tests) that this attribute is always returned, I need to also mark it as
required
. But when I mark it asrequired
Committee throws anInvalidRequest
error (when callingassert_schema_conform
) if I don't pass it in myPATCH
request in my tests.It should actually fail if I pass the
type
attribute in thePATCH
request.Or am I wrong here? 🤔
The text was updated successfully, but these errors were encountered: