Skip to content

AdditionalPropertiesAllowed is not serialized into additionalProperties even when explicitly set to false #2664

@shazamViz

Description

@shazamViz

Describe the bug

When generating an OpenAPI document using Microsoft.OpenApi, setting
OpenApiSchema.AdditionalPropertiesAllowed = false does not result in
additionalProperties: false being emitted in the generated OpenAPI document.

As a result, it is currently impossible to generate a "closed" object schema
(using additionalProperties: false) through the public API, even though
AdditionalPropertiesAllowed exists on OpenApiSchema.

This leads to incorrect OpenAPI output and breaks downstream tools such as
NSwag, OpenAPI Generator, Kiota, etc.

Expected behavior

When AdditionalPropertiesAllowed is explicitly set to false, the generated
OpenAPI should contain:

additionalProperties: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions