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
I am using libopenapi in a project to render documentation, and I used the mock generator to render the responses of different operations.
While it was working as expected, I encountered a minor annoyance. I crossed a case where the Media type response had no example and used a schema reference.
The mock generator generated a mock response, but I noticed it was omitting a few fields. After a couple of experiments, I realized that this behavior was related to the use of required in the schema object. Removing this provided a complete working example.
Is there a way to switch this (maybe through an mg.OnlyRequired() switch? That would greatly help, especially when you prefer to render a complete response example for schemas that include a required field.
Let me know if I can help. I can open a PR for this.
P.S. Heh #200 nice 👍🏼 😄
The text was updated successfully, but these errors were encountered:
Hello @daveshanley, a different method would be sufficient for me (and also keeps things clean). The expected behavior would be that when calling that method, you get a mock with all the schema fields regardless of the required state.
A new switch method features on the renderer.SchemaRenderer struct called DisableRequiredCheck() This will render all properties, regardless of the 'required` property values.
I am using libopenapi in a project to render documentation, and I used the mock generator to render the responses of different operations.
While it was working as expected, I encountered a minor annoyance. I crossed a case where the Media type response had no example and used a schema reference.
The mock generator generated a mock response, but I noticed it was omitting a few fields. After a couple of experiments, I realized that this behavior was related to the use of
required
in the schema object. Removing this provided a complete working example.Is there a way to switch this (maybe through an
mg.OnlyRequired()
switch? That would greatly help, especially when you prefer to render a complete response example for schemas that include arequired
field.Let me know if I can help. I can open a PR for this.
P.S. Heh
#200
nice 👍🏼 😄The text was updated successfully, but these errors were encountered: