You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default JSON request body of the "TryIt" panel contains properties that are marked as read-only. Requests that are sent with those example request bodies will always be invalid.
Current Behavior
The default JSON request body of the "TryIt" panel contains read-only properties.
Expected Behavior
The default JSON request body of the "TryIt" panel should omit read-only properties.
Possible Workaround/Solution
There is a workaround for POST endpoints but none for PATCH endpoints, I didn't try PUT endpoints:
The workaround for POST endpoints is to create an example request body that doesn't contain read-only properties. This doesn't work for PATCH endpoints, as Elements generates a default example that contains the example value of each property (including read-only properties) and displays that by default.
Steps to Reproduce
See "TryIt" panel of this PATCH endpoint of our OpenApi Spec: https://docs.pruefster.com/preview/v2/operations/patch-exams (Created with Stoplight Elements). The example JSON request body contains read-only properties (eg: id, token, created_at etc.) of the referenced Exam schema. Note that these properties are not displayed by Elements in the definition of the request body itself though.
Create an OpenApi document (using Stoplight Studio) with a schema that contains read-only properties
Create a PATCH or POST endpoint
Add a JSON request body to that endpoint that references the schema from step 1
The JSON request body of the "TryIt" panel of Elements for that OpenApi document should show the read-only properties of the schema
Thank you for providing awesome OpenApi Tooling!
Context
The default JSON request body of the "TryIt" panel contains properties that are marked as read-only. Requests that are sent with those example request bodies will always be invalid.
Current Behavior
The default JSON request body of the "TryIt" panel contains read-only properties.
Expected Behavior
The default JSON request body of the "TryIt" panel should omit read-only properties.
Possible Workaround/Solution
There is a workaround for POST endpoints but none for PATCH endpoints, I didn't try PUT endpoints:
The workaround for POST endpoints is to create an example request body that doesn't contain read-only properties. This doesn't work for PATCH endpoints, as Elements generates a
default
example that contains the example value of each property (including read-only properties) and displays that by default.Steps to Reproduce
See "TryIt" panel of this PATCH endpoint of our OpenApi Spec: https://docs.pruefster.com/preview/v2/operations/patch-exams (Created with Stoplight Elements). The example JSON request body contains read-only properties (eg:
id
,token
,created_at
etc.) of the referencedExam
schema. Note that these properties are not displayed by Elements in the definition of the request body itself though.Environment
Our environment is very minimalistic and basically mirrors this HTML example that you provide in your documentation: https://meta.stoplight.io/docs/elements/ZG9jOjMyNjU4OTYz-elements-in-html
The text was updated successfully, but these errors were encountered: