@@ -557,7 +557,7 @@ data Schema = Schema
558 , _schemaAllOf :: Maybe [Referenced Schema]
558 , _schemaAllOf :: Maybe [Referenced Schema]
559 , _schemaProperties :: InsOrdHashMap Text (Referenced Schema)
559 , _schemaProperties :: InsOrdHashMap Text (Referenced Schema)
560− , _schemaAdditionalProperties :: Maybe (Referenced Schema)
560+ , _schemaAdditionalProperties :: Maybe AdditionalProperties
562 , _schemaDiscriminator :: Maybe Text
562 , _schemaDiscriminator :: Maybe Text
563 , _schemaReadOnly :: Maybe Bool
563 , _schemaReadOnly :: Maybe Bool
@@ -802,6 +802,11 @@ instance IsString a => IsString (Referenced a) where
803newtype URL = URL { getUrl :: Text } deriving (Eq, Ord, Show, ToJSON, FromJSON, Data, Typeable)
803newtype URL = URL { getUrl :: Text } deriving (Eq, Ord, Show, ToJSON, FromJSON, Data, Typeable)
805+data AdditionalProperties
806+ = AdditionalPropertiesAllowed Bool
807+ | AdditionalPropertiesSchema (Referenced Schema)
808+ deriving (Eq, Show, Data, Typeable)
805-- =======================================================================
810-- =======================================================================
806-- Monoid instances
811-- Monoid instances
807-- =======================================================================
812-- =======================================================================
@@ -1125,6 +1130,10 @@ instance ToJSON (ParamSchema k) where
1125 toJSON = sopSwaggerGenericToJSONWithOpts $
1130 toJSON = sopSwaggerGenericToJSONWithOpts $
1126 mkSwaggerAesonOptions "paramSchema" & saoSubObject ?~ "items"
1131 mkSwaggerAesonOptions "paramSchema" & saoSubObject ?~ "items"
1133+instance ToJSON AdditionalProperties where
1134+ toJSON (AdditionalPropertiesAllowed b) = toJSON b
1135+ toJSON (AdditionalPropertiesSchema s) = toJSON s
1128-- =======================================================================
1137-- =======================================================================
1129-- Manual FromJSON instances
1138-- Manual FromJSON instances
1130-- =======================================================================
1139-- =======================================================================
@@ -1280,6 +1289,10 @@ instance FromJSON (ParamSchema 'SwaggerKindParamOtherSchema) where
1280instance FromJSON (ParamSchema 'SwaggerKindSchema) where
1289instance FromJSON (ParamSchema 'SwaggerKindSchema) where
1281 parseJSON = sopSwaggerGenericParseJSON
1290 parseJSON = sopSwaggerGenericParseJSON
1292+instance FromJSON AdditionalProperties where
1293+ parseJSON (Bool b) = pure $ AdditionalPropertiesAllowed b
1294+ parseJSON js = AdditionalPropertiesSchema <$> parseJSON js
1283-------------------------------------------------------------------------------
1296-------------------------------------------------------------------------------
1284-- TH splices
1297-- TH splices
1285-------------------------------------------------------------------------------
1298-------------------------------------------------------------------------------