Skip to content

Commit

Permalink
Add struct?: false to all openapispex schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
CDimonaco committed Jul 15, 2024
1 parent 38749b6 commit 486d9ed
Show file tree
Hide file tree
Showing 32 changed files with 2,184 additions and 1,867 deletions.
56 changes: 31 additions & 25 deletions lib/trento_web/openapi/v1/schema/ability.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,43 @@ defmodule TrentoWeb.OpenApi.V1.Schema.Ability do
defmodule AbilityItem do
@moduledoc false

OpenApiSpex.schema(%{
title: "Ability",
description: "Ability entry",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :integer, description: "Ability ID", nullable: false},
name: %Schema{type: :string, description: "Ability name", nullable: false},
resource: %Schema{
type: :string,
description: "Resource attached to ability",
nullable: false
OpenApiSpex.schema(
%{
title: "Ability",
description: "Ability entry",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{type: :integer, description: "Ability ID", nullable: false},
name: %Schema{type: :string, description: "Ability name", nullable: false},
resource: %Schema{
type: :string,
description: "Resource attached to ability",
nullable: false
},
label: %Schema{
type: :string,
description: "Description of the ability",
nullable: false
}
},
label: %Schema{
type: :string,
description: "Description of the ability",
nullable: false
}
required: [:id, :name, :resource]
},
required: [:id, :name, :resource]
})
struct?: false
)
end

defmodule AbilityCollection do
@moduledoc false

OpenApiSpex.schema(%{
title: "AbilityCollection",
description: "A collection of abilities in the system",
type: :array,
items: AbilityItem
})
OpenApiSpex.schema(
%{
title: "AbilityCollection",
description: "A collection of abilities in the system",
type: :array,
items: AbilityItem
},
struct?: false
)
end
end
67 changes: 35 additions & 32 deletions lib/trento_web/openapi/v1/schema/activity_log.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,40 @@ defmodule TrentoWeb.OpenApi.V1.Schema.ActivityLog do
require OpenApiSpex
alias OpenApiSpex.Schema

OpenApiSpex.schema(%{
title: "ActivityLog",
description: "Activity Log for the current installation.",
type: :array,
items: %Schema{
title: "ActivityLogEntry",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{
type: :string,
description: "Identifier of Activity Log entry.",
format: :uuid
OpenApiSpex.schema(
%{
title: "ActivityLog",
description: "Activity Log for the current installation.",
type: :array,
items: %Schema{
title: "ActivityLogEntry",
type: :object,
additionalProperties: false,
properties: %{
id: %Schema{
type: :string,
description: "Identifier of Activity Log entry.",
format: :uuid
},
type: %Schema{
type: :string,
description: "Type of Activity Log entry."
},
actor: %Schema{
type: :string,
description: "Actor causing an Activity Log entry. E.g. System or a specific user."
},
metadata: %Schema{
type: :object
},
occurred_on: %Schema{
type: :string,
description: "Timestamp upon Activity Log entry insertion."
}
},
type: %Schema{
type: :string,
description: "Type of Activity Log entry."
},
actor: %Schema{
type: :string,
description: "Actor causing an Activity Log entry. E.g. System or a specific user."
},
metadata: %Schema{
type: :object
},
occurred_on: %Schema{
type: :string,
description: "Timestamp upon Activity Log entry insertion."
}
},
required: [:id, :type, :actor, :metadata, :occurred_on]
}
})
required: [:id, :type, :actor, :metadata, :occurred_on]
}
},
struct?: false
)
end
Loading

0 comments on commit 486d9ed

Please sign in to comment.