You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows platform only when using the ash.patch.extend to extend a resource with Graphql the diff does not work and you end up with garbled code in the updated resource.
Original resource:
defmodule AshServer.Accounts.App do
@moduledoc """
Ressource representing an application in the eco-system.
"""
use Ash.Resource,
domain: AshServer.Accounts,
data_layer: AshPostgres.DataLayer
alias AshServer.Accounts.PermissionGroup
alias AshServer.Accounts.User
postgres do
table "apps"
repo AshServer.Repo
end
actions do
create :create do
accept [:name, :description, :is_active, :creator_id]
end
read :read do
primary? true
end
update :update do
accept [:description, :is_active, :updater_id]
end
destroy :destroy do
end
end
attributes do
attribute :id, :uuid_v7 do
description "Identificateur"
writable? false
default &Ash.UUIDv7.generate/0
primary_key? true
allow_nil? false
end
attribute :name, :string, allow_nil?: false, description: "Nom"
attribute :description, :string, allow_nil?: false, description: "Description"
attribute :is_active, :boolean, description: "Actif?"
create_timestamp :created_at, description: "Création"
update_timestamp :updated_at, description: "Mis-à-jour"
end
relationships do
has_many :permission_groups, PermissionGroup
belongs_to :creator, User
belongs_to :updater, User
end
identities do
identity :unique_name, [:name]
end
end
After running mix ash.patch.extend:
defmodule AshServer.Accounts.App do
@moduledoc """
Ressource representing an application in the eco-system.
"""
use Ash.Resource,
domain: AshServer.Accounts,
data_layer: AshPostgres.DataLayer,
extensions: [AshGraphql.Resource]
alias AshServer.Accounts.PermissionGroup
alias AshServer.Accounts.User
graphql do
type :app
endepo(AshServer.Repo)
end
postgres do
table "apps"
repo AshServer.Repo
endnd
end
actions do
create :create do
accept [:name, :description, :is_active, :creator_id]
end
read :read do
primary? true
end
update :update do
accept [:description, :is_active, :updater_id]
end
destroy :destroy do
end
endpdate_timestamp(:updated_at, description: "Mis-à-jour")
end
attributes do
attribute :id, :uuid_v7 do
description "Identificateur"
writable? false
default &Ash.UUIDv7.generate/0
primary_key? true
allow_nil? false
end
attribute :name, :string, allow_nil?: false, description: "Nom"
attribute :description, :string, allow_nil?: false, description: "Description"
attribute :is_active, :boolean, description: "Actif?"
create_timestamp :created_at, description: "Création"
update_timestamp :updated_at, description: "Mis-à-jour"
endelongs_to(:updater, User)
end
relationships do
has_many :permission_groups, PermissionGroup
belongs_to :creator, User
belongs_to :updater, User
enddentity(:unique_name, [:name])
end
identities do
identity :unique_name, [:name]
endype(:app)
end
end
Expected behavior
The extension and graphql section should be inserted into the resource without making it uncompilable.
It seems to have something to do with the end keyword as it gets inserted in different places.
** Runtime
Elixir version 1.17.3
Erlang OTP 27 [erts-15.2]
OS Windows 11
Igniter version 0.5.88
Additional context
This seems to be OS specific to Windows as I tested it on Ubuntu and it worked fine.
The text was updated successfully, but these errors were encountered:
On Windows platform only when using the
ash.patch.extend
to extend a resource with Graphql the diff does not work and you end up with garbled code in the updated resource.Original resource:
After running
mix ash.patch.extend
:Expected behavior
The extension and graphql section should be inserted into the resource without making it uncompilable.
It seems to have something to do with the
end
keyword as it gets inserted in different places.** Runtime
Additional context
This seems to be OS specific to Windows as I tested it on Ubuntu and it worked fine.
The text was updated successfully, but these errors were encountered: