Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #471
This PR extends the openapi plugin functionality to also make it possible to extract example values from the openapi schemas (current behavior only looks for examples defined under the
example
orexamples
keys).There are 2 limitations for the examples generation:
allOf
, all schemas inside of it must have anobject
type, otherwise examples are not generatedpattern
property (typestring
) is not yet supported, example just resolves to"string"
.The current solution uses a custom logic to generate examples, but probably a better approach was to use the existing code from swagger to generate the expected example values (like in the swagger editor), but I couldn't find the part of the code responsible for the examples generation.
I would be more than happy to update this PR if anyone could point me in the right direction.