Skip to content

Commit

Permalink
add type information to array schemas
Browse files Browse the repository at this point in the history
see #10
  • Loading branch information
dealloc committed Mar 6, 2024
1 parent c5c7241 commit e860380
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/helldivers_2_web/schemas/planet_schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ defmodule Helldivers2Web.Schemas.PlanetSchema do
},
waypoints: %Schema{
type: :array,
items: %Schema{type: :integer},
description: "Waypoints, seems to link planets together but purpose unclear"
},
max_health: %Schema{
Expand Down
17 changes: 14 additions & 3 deletions lib/helldivers_2_web/schemas/war_info_schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ defmodule Helldivers2Web.Schemas.WarInfoSchema do
alias Helldivers2Web.Schemas.{PlanetSchema, HomeWorldSchema}

@doc "Generates a schema for a single war info schema response"
def response(), do: {"War info response", "application/json", __MODULE__, Helldivers2Web.ApiSpec.default_options()}
def response(),
do:
{"War info response", "application/json", __MODULE__,
Helldivers2Web.ApiSpec.default_options()}

OpenApiSpex.schema(%{
description: "Global overview of the war, it's planets, capitals etc",
Expand Down Expand Up @@ -40,8 +43,16 @@ defmodule Helldivers2Web.Schemas.WarInfoSchema do
items: HomeWorldSchema,
description: "All homeworlds present in this war season"
},
capitals: %Schema{type: :array, description: "Empty, not been mapped yet"},
planet_permanent_effects: %Schema{type: :array, description: "Empty, not been mapped yet"}
capitals: %Schema{
type: :array,
items: %Schema{type: :integer},
description: "Empty, not been mapped yet"
},
planet_permanent_effects: %Schema{
type: :array,
items: %Schema{type: :integer},
description: "Empty, not been mapped yet"
}
}
})
end
8 changes: 7 additions & 1 deletion lib/helldivers_2_web/schemas/war_status_schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ defmodule Helldivers2Web.Schemas.WarStatusSchema do
alias OpenApiSpex.Schema

@doc "Generates a schema for a single war info schema response"
def response(), do: {"War status response", "application/json", __MODULE__, Helldivers2Web.ApiSpec.default_options()}
def response(),
do:
{"War status response", "application/json", __MODULE__,
Helldivers2Web.ApiSpec.default_options()}

OpenApiSpex.schema(%{
description: "Current status of the Helldivers offensive in the galactic war",
Expand Down Expand Up @@ -50,16 +53,19 @@ defmodule Helldivers2Web.Schemas.WarStatusSchema do
},
community_targets: %Schema{
type: :array,
items: %Schema{type: :integer},
description: "Always empty AFAIK, haven't figured this out"
},
joint_operations: %Schema{type: :array, items: JointOperationSchema},
planet_events: %Schema{type: :array, items: PlanetEventSchema},
planet_active_effects: %Schema{
type: :array,
items: %Schema{type: :integer},
description: "Always empty AFAIK, haven't figured this out"
},
active_election_policy_effects: %Schema{
type: :array,
items: %Schema{type: :integer},
description: "Always empty AFAIK, haven't figured this out"
},
global_events: %Schema{type: :array, items: GlobalEventSchema}
Expand Down

0 comments on commit e860380

Please sign in to comment.