Skip to content

Conversation

@vonBrax
Copy link

@vonBrax vonBrax commented Mar 18, 2024

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 or examples keys).

There are 2 limitations for the examples generation:

  • When using allOf, all schemas inside of it must have an object type, otherwise examples are not generated
  • The pattern property (type string) 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants