@@ -557,7 +557,7 @@ data Schema = Schema
557557
558558 , _schemaAllOf :: Maybe [Referenced Schema]
559559 , _schemaProperties :: InsOrdHashMap Text (Referenced Schema)
560− , _schemaAdditionalProperties :: Maybe (Referenced Schema)
560+ , _schemaAdditionalProperties :: Maybe AdditionalProperties
561561
562562 , _schemaDiscriminator :: Maybe Text
563563 , _schemaReadOnly :: Maybe Bool
@@ -802,6 +802,11 @@ instance IsString a => IsString (Referenced a) where
802802
803803newtype URL = URL { getUrl :: Text } deriving (Eq, Ord, Show, ToJSON, FromJSON, Data, Typeable)
804804
805+data AdditionalProperties
806+ = AdditionalPropertiesAllowed Bool
807+ | AdditionalPropertiesSchema (Referenced Schema)
808+ deriving (Eq, Show, Data, Typeable)
809+
805810-- =======================================================================
806811-- Monoid instances
807812-- =======================================================================
@@ -1125,6 +1130,10 @@ instance ToJSON (ParamSchema k) where
11251130 toJSON = sopSwaggerGenericToJSONWithOpts $
11261131 mkSwaggerAesonOptions "paramSchema" & saoSubObject ?~ "items"
11271132
1133+instance ToJSON AdditionalProperties where
1134+ toJSON (AdditionalPropertiesAllowed b) = toJSON b
1135+ toJSON (AdditionalPropertiesSchema s) = toJSON s
1136+
11281137-- =======================================================================
11291138-- Manual FromJSON instances
11301139-- =======================================================================
@@ -1280,6 +1289,10 @@ instance FromJSON (ParamSchema 'SwaggerKindParamOtherSchema) where
12801289instance FromJSON (ParamSchema 'SwaggerKindSchema) where
12811290 parseJSON = sopSwaggerGenericParseJSON
12821291
1292+instance FromJSON AdditionalProperties where
1293+ parseJSON (Bool b) = pure $ AdditionalPropertiesAllowed b
1294+ parseJSON js = AdditionalPropertiesSchema <$> parseJSON js
1295+
12831296-------------------------------------------------------------------------------
12841297-- TH splices
12851298-------------------------------------------------------------------------------