Skip to content

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

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

Activity

  1. baywet commented on Jan 5, 2026

    @baywet
    Member

    Hi shazamViz
    Thank you for using the SDK and for reaching out.

    What version of the library are you using? could you please double check you're on the latest version for that major?

    We had a very similar issue a couple of weeks ago which was fixed and relased:

    Let us know if you have any additional comments or questions.

  2. shazamViz commented on Jan 6, 2026

    @shazamViz
    Author

    Hi,

    Thanks for your answer and sorry for not specifying which version I was using.
    I was using v2.3.12 (released on december 15) for compatibility purpose with Microsoft.AspNetCore.OpenApi v10.0.1, I missed december 16 and december 17 upgrades, it's working as expected with the latest version.

  3. baywet commented on Jan 6, 2026

    @baywet
    Member

    Thank you for the additional information.
    Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions