Skip to content

Commit

Permalink
fix: allow floating point numbers for multipleOf
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-bach committed Feb 18, 2024
1 parent 41d9864 commit 0013a75
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Schema = Referencable SchemaObject
data SchemaObject = SchemaObject
{ schemaObjectType :: SchemaType,
schemaObjectTitle :: Maybe Text,
schemaObjectMultipleOf :: Maybe Integer,
schemaObjectMultipleOf :: Maybe Float,
schemaObjectMaximum :: Maybe Float,
schemaObjectExclusiveMaximum :: Bool,
schemaObjectMinimum :: Maybe Float,
Expand Down
2 changes: 2 additions & 0 deletions specifications/z_complex_self_made_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,13 @@ components:
int64:
type: integer
format: int64
multipleOf: 4
number:
type: number
float:
type: number
format: float
multipleOf: 0.01
double:
type: number
format: double
Expand Down
8 changes: 8 additions & 0 deletions testing/golden-output/src/OpenAPI/Types/Dog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,18 @@ data Dog = Dog {
-- | father
, dogFather :: (GHC.Maybe.Maybe Data.Aeson.Types.Internal.Object)
-- | float
--
-- Constraints:
--
-- * Must be a multiple of 1.0e-2
, dogFloat :: (GHC.Maybe.Maybe GHC.Types.Float)
-- | int32
, dogInt32 :: (GHC.Maybe.Maybe GHC.Int.Int32)
-- | int64
--
-- Constraints:
--
-- * Must be a multiple of 4.0
, dogInt64 :: (GHC.Maybe.Maybe GHC.Int.Int64)
-- | integer
, dogInteger :: (GHC.Maybe.Maybe GHC.Types.Int)
Expand Down
8 changes: 8 additions & 0 deletions testing/golden-output/src/OpenAPI/Types/Mischling.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,20 @@ data Mischling = Mischling {
-- | first_relative
, mischlingFirst_relative :: (GHC.Maybe.Maybe MischlingFirst_relative)
-- | float
--
-- Constraints:
--
-- * Must be a multiple of 1.0e-2
, mischlingFloat :: (GHC.Maybe.Maybe GHC.Types.Float)
-- | huntssecond
, mischlingHuntssecond :: (GHC.Maybe.Maybe GHC.Types.Bool)
-- | int32
, mischlingInt32 :: (GHC.Maybe.Maybe GHC.Int.Int32)
-- | int64
--
-- Constraints:
--
-- * Must be a multiple of 4.0
, mischlingInt64 :: (GHC.Maybe.Maybe GHC.Int.Int64)
-- | integer
, mischlingInteger :: (GHC.Maybe.Maybe GHC.Types.Int)
Expand Down

0 comments on commit 0013a75

Please sign in to comment.