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

Add support for defining custom map types #39

Merged
merged 1 commit into from
Jan 25, 2024
Merged

Conversation

solnic
Copy link
Owner

@solnic solnic commented Jan 25, 2024

This builds on top of the custom type API and allows you to define a custom map type, like this:

defmodule User do
  use Drops.Type, %{
    required(:name) => string(),
    optional(:age) => integer()
  }
end

defmodule AccountContract do
  use Drops.Contract

  schema do
    %{
      required(:account) => %{
        required(:user) => User
      }
    }
  end
end

@solnic solnic merged commit 6b6e2e8 into main Jan 25, 2024
9 checks passed
@solnic solnic deleted the support-custom-map-types branch January 25, 2024 08:19
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.

1 participant