Skip to content

TransformLegacyDocument adds requireParametersWithoutDefault which is not saved #5303

@copyleftproducts

Description

@copyleftproducts

When the nswag document contains the text "nobuild:", the TransformLegacyDocument method adds "requireParametersWithoutDefault": true and sets saveFile=true

https://github.com/RicoSuter/NSwag/blob/e4e30bfe7c9dd92148dc275b9f4ab1415efdf103/src/NSwag.Commands/NSwagDocumentBase.cs#L516C1-L520C14

This property is not loaded and/or saved by the LoadDocument+SaveAsync calls in the LoadAsync method.
https://github.com/RicoSuter/NSwag/blob/e4e30bfe7c9dd92148dc275b9f4ab1415efdf103/src/NSwag.Commands/NSwagDocumentBase.cs#L170C1-L177C14

When the attached file is processed by NSwag.Console, the file is transformed and saved on every execution.

We ran into this issue as the relative paths in our nswag.json were modified (adding extra "..\") causing subsequent builds to fail. See related issue #1886.

nswag.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions