-
Notifications
You must be signed in to change notification settings - Fork 9k
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
OAS 3.0: readOnly properties are included in request body examples #3445
Comments
@hkosova Running the latest I don't see the |
@owenconti, yes, this seems to be fixed already. 🎉 |
It looks like this is still an issue for paths:
/users:
post:
summary: Create a user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/User'
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/User'
components:
schemas:
User:
type: object
properties:
id:
type: integer
example: 5
readOnly: true
name:
type: string
example: Bob
example_attribute:
type: object
$ref: '#/components/schemas/AnotherModel'
readOnly: true The |
@amochohan, example_attribute:
readOnly: true
allOf:
- $ref: '#/components/schemas/AnotherModel' Here's a related discussion about combining |
Thanks @hkosova, apologies if this wasn't the correct medium through which to have raised this. |
EDIT: Nevermind this.Just realised it is an issue with the SwaggerDoc, not OpenAPI. The online editor display examples properly. The version we have offline does not. My apologies Original postI still have the same problem, observed in SwaggerDoc. Should I post this here, since it is a closed issue (to be reopened) or should I create a new one? |
Version:
ft/oas3
branch, commit a1ce0e7In 3.0 specs, request body examples generated from the
schema
include read-only properties -- but they should not be included in requests. The issue does not exist in 2.0 specs.Spec:
Expected result: Request body example is:
Actual result: Request body example includes the read-only property
id
:The text was updated successfully, but these errors were encountered: