Skip to content

Leaving relationship field empty in ash_postgres.gen.resources causes error #634

@stocks29

Description

@stocks29

Code of Conduct

  • I agree to follow this project's Code of Conduct

AI Policy

  • I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.

Versions

❯ elixir -v
Erlang/OTP 27 [erts-15.2.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.18.2 (compiled with Erlang/OTP 25)

ash_postgres 2.6.17

Operating system

Mac OS

Current Behavior

Leave empty to skip adding this relationship.

Name:

** (FunctionClauseError) no function clause matching in String.trim/1

The following arguments were given to String.trim/1:

    # 1
    nil

Attempted function clauses (showing 1 out of 1):

    def trim(string) when is_binary(string)

(elixir 1.18.2) lib/string.ex:1321: String.trim/1
(ash_postgres 2.6.17) lib/resource_generator/spec.ex:784: AshPostgres.ResourceGenerator.Spec.name_all_relationships/6
(elixir 1.18.2) lib/enum.ex:1276: anonymous fn/3 in Enum.flat_map/2
(stdlib 6.2) maps.erl:860: :maps.fold_1/4
(elixir 1.18.2) lib/enum.ex:2558: Enum.flat_map/2
(ash_postgres 2.6.17) lib/resource_generator/spec.ex:725: anonymous fn/3 in AshPostgres.ResourceGenerator.Spec.do_add_relationships/3
(elixir 1.18.2) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.18.2) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2

Reproduction

  1. mix ash_postgres.gen.resources MyApp.App
  2. when prompted to give relationship name, just hit enter

Expected Behavior

Relationship is skipped

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    Projects

    Status

    Soon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions