-
-
Notifications
You must be signed in to change notification settings - Fork 924
Closed
Description
API Platform version(s) affected: 2.6.4
Description
(extracted from #4215 (comment))
With default config + denormalizationContext={"allow_extra_attributes": false}
, the generated OpenAPI schemas don't have "additionalProperties": false
.
How to reproduce
Config:
api_platform:
defaults:
denormalization_context:
allow_extra_attributes: false
and some dummy API resource.
Command (in a Symfony app): php bin/console api:openapi:export
Possible Solution
Remove this line:
$schema->setDefinitions($schemas);
(introduced by a commit titled "Improve openapi performances").
Additional Context
Even #4247 doesn't fix it.
But if I customize the config by adding this:
formats:
jsonld: ['application/ld+json']
patch_formats:
json: ['application/merge-patch+json']
then [well, I lose /docs.json and Swagger UI, but I can still run the command, and] the generated schemas do have "additionalProperties": false
🤔