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
given an API specification mixing required keyword and readOnly , writeOnly redocly generate a warning wheras it should not
To Reproduce
given the minimal files attached small.json
redocly lint generate 2 warnings
Expected behavior
it should not,
the object contains Id , name , password , both are required ... in differents scenario
id is set to ReadOnly
password as WriteOnly
i would expect to do a single representation of my object, for input / output and exemple matching
this is a quite common use case (especially for id that is generated by server so mandatory in return only ... so readOnly)
i extended the use case to writeOnly and password just for the record.
The Json Schema specification is not 100 % clear if there is a precedence between required statement and the readOnly and writeOnly context .
=> discussing with JsonSchema team , it is up to the upper layer aka OAS / and so redocly to "customize" the validation as it is the only pieces that has the information
Logs
Example value must conform to the schema: must have required property 'id'.
80 | "inputExample" : {
81 | "description" : "sampleOfInput",
82 | "value" : {
83 | "name" : "Doe",
84 | "password" : "securityFirst"
85 | }
86 | },
87 | "outputExample" : {
referenced from small.json:23:45 at #/paths/~1test/post/requestBody/content/application~1json
Warning was generated by the no-invalid-media-type-examples rule.
[2] small.json:89:27 at #/components/examples/outputExample/value
Example value must conform to the schema: must have required property 'password'.
87 | "outputExample" : {
88 | "description" : "sampleOfOutPut",
89 | "value" : {
90 | "id" : "goodId",
91 | "name" : "Doe"
92 | }
93 | }
94 | }
referenced from small.json:39:49 at #/paths/~1test/post/responses/200/content/application~1json
Warning was generated by the no-invalid-media-type-examples rule.
Redocly Version(s)
redocly 1.8.1
Additional context
thx for your attention , do not hesitate to close it if you consider it as too corner case
The text was updated successfully, but these errors were encountered:
Hi, I ran into this exact issue. We make use of the readOnly attribute a lot in our definitions, and I think it would be great if you could fix this issue. It is interesting that another OpenAPI linter ran into the same issue and fixed it.
Describe the bug
given an API specification mixing required keyword and readOnly , writeOnly redocly generate a warning wheras it should not
To Reproduce
given the minimal files attached small.json
redocly lint generate 2 warnings
Expected behavior
it should not,
the object contains Id , name , password , both are required ... in differents scenario
i would expect to do a single representation of my object, for input / output and exemple matching
this is a quite common use case (especially for id that is generated by server so mandatory in return only ... so readOnly)
i extended the use case to writeOnly and password just for the record.
The Json Schema specification is not 100 % clear if there is a precedence between required statement and the readOnly and writeOnly context .
=> discussing with JsonSchema team , it is up to the upper layer aka OAS / and so redocly to "customize" the validation as it is the only pieces that has the information
Logs
Redocly Version(s)
redocly 1.8.1
Additional context
thx for your attention , do not hesitate to close it if you consider it as too corner case
The text was updated successfully, but these errors were encountered: