Skip to content

Commit f9da197

Browse files
fixed some typing and remove constant outside atoms
Signed-off-by: Gabriele Ghio <gabriele.ghio@secomind.com>
1 parent 9cbf4c6 commit f9da197

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/astarte/core/generators/interface.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ defmodule Astarte.Core.Generators.Interface do
131131
132132
https://docs.astarte-platform.org/astarte/latest/030-interface.html#interface-type
133133
"""
134-
@spec type() :: StreamData.t(String.t())
134+
@spec type() :: StreamData.t(:datastream | :properties)
135135
def type, do: member_of([:datastream, :properties])
136136

137137
@doc false

lib/astarte/core/generators/mapping.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ defmodule Astarte.Core.Generators.Mapping do
157157
@spec reliability(:datastream | :properties) ::
158158
StreamData.t(:unreliable | :guaranteed | :unique | nil)
159159
def reliability(:datastream), do: member_of([:unreliable, :guaranteed, :unique])
160-
def reliability(_), do: nil
160+
def reliability(_), do: constant(nil)
161161

162162
@doc false
163163
@spec explicit_timestamp(:datastream | :properties) :: StreamData.t(boolean())
@@ -170,21 +170,21 @@ defmodule Astarte.Core.Generators.Mapping do
170170
def retention(_), do: constant(:discard)
171171

172172
@doc false
173-
@spec expiry(:datastream | :properties) :: StreamData.t(0 | pos_integer())
173+
@spec expiry(:datastream | :properties) :: StreamData.t(pos_integer() | 0)
174174
def expiry(:datastream), do: one_of([constant(0), integer(1..10_000)])
175175
def expiry(_), do: constant(0)
176176

177177
@doc false
178178
@spec database_retention_policy(:datastream | :properties) ::
179179
StreamData.t(:no_ttl | :use_ttl | nil)
180180
def database_retention_policy(:datastream), do: member_of([:no_ttl, :use_ttl])
181-
def database_retention_policy(_), do: nil
181+
def database_retention_policy(_), do: constant(nil)
182182

183183
@doc false
184184
@spec database_retention_ttl(:datastream | :properties, :use_ttl | :no_ttl) ::
185185
StreamData.t(non_neg_integer() | nil)
186186
def database_retention_ttl(:datastream, :use_ttl), do: integer(60..1_048_576)
187-
def database_retention_ttl(_, _), do: nil
187+
def database_retention_ttl(_, _), do: constant(nil)
188188

189189
@doc false
190190
@spec allow_unset(:datastream | :properties) :: StreamData.t(boolean())

0 commit comments

Comments
 (0)