OpenAPI schemas for maps should indicate they are objects

This commit is contained in:
Daniel Chambers 2022-06-16 16:38:00 +10:00
parent 00649ce417
commit 6bdfb8d27c
3 changed files with 8 additions and 4 deletions

View File

@ -6,7 +6,8 @@
"maximum": 9223372036854775807,
"minimum": -9223372036854775808,
"type": "number"
}
},
"type": "object"
}
}
},

View File

@ -4,7 +4,8 @@
"(KeyMap Value)": {
"additionalProperties": {
"additionalProperties": true
}
},
"type": "object"
}
}
},

View File

@ -67,7 +67,8 @@ declareNamedSchemaVia c' Proxy = evalStateT (go c') mempty
pure $
NamedSchema Nothing $
mempty
{ _schemaAdditionalProperties = Just $ AdditionalPropertiesSchema $ _namedSchemaSchema <$> itemsSchemaRef
{ _schemaType = Just OpenApiObject,
_schemaAdditionalProperties = Just $ AdditionalPropertiesSchema $ _namedSchemaSchema <$> itemsSchemaRef
}
MapCodec c -> do
itemsSchema <- go c
@ -75,7 +76,8 @@ declareNamedSchemaVia c' Proxy = evalStateT (go c') mempty
pure $
NamedSchema Nothing $
mempty
{ _schemaAdditionalProperties = Just $ AdditionalPropertiesSchema $ _namedSchemaSchema <$> itemsSchemaRef
{ _schemaType = Just OpenApiObject,
_schemaAdditionalProperties = Just $ AdditionalPropertiesSchema $ _namedSchemaSchema <$> itemsSchemaRef
}
ValueCodec ->
pure $