Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds features to example functionality #603

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

riccardomanfrin
Copy link
Contributor

  1. Allows generation of context based on regexp

  2. Allows for non object types anyOf's and oneOf's like

     obj:
       anyOf:
         enum:
           - DSL
           - PON
         type: string
    

@@ -402,6 +402,10 @@ defmodule OpenApiSpex.Schema do
def example(%Schema{type: :string, format: :"date-time"}), do: "2020-04-20T16:20:00Z"
def example(%Schema{type: :string, format: :uuid}), do: "02ef9c5f-29e6-48fc-9ec3-7ed57ed351f6"

def example(%Schema{type: :string, pattern: regexp}) when is_binary(regexp), do:
Randex.stream(Regex.compile!(regexp))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If randex is an optional dependency, then this should have some runtime check for the Randex module being loaded?

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.

None yet

2 participants