I am generating code for resolved json for my api project using following command,
"nswag run .\nswag\server.controller.nswag /runtime:NetCore21".
I have placed "additinalProperties" as 'false' for all the internal models where as it's type is, "object". This has resolved the my issue without adding additionalPropertie fields to my code.
But, still it's adding for some of the models. For example,
1.
PartCreate:
description: Part Creation Model
additionalProperties: false
properties:
partId:
description: A unique id.
type: string
example: 00000000
brandCode:
description: 'The part''s brand code.
type: string
example: XXXX
partCode:
description: 'The part''s code.
type: string
example: 8765432
quantity:
format: double
description: >
The quantity of the Part.
> Each Part has a default `unitOfMeasure`, which indicates the
'real' value of the numerical `quantity` field.
type: number
example: 1
2. For some of the models i am adding as dependencies. For this models also it's adding it in .net code.
Do, we have any option where we can able to place "additinalProperties" as false globally? Or do you guys has any solution from your side?
The spec defines the default of additinalProperties as "true" - you cannot change that globally. The only option now is to preprocess the schema before generating the clients...
Hi Team,
I am generating code for resolved json for my api project using following command, "nswag run .\nswag\server.controller.nswag /runtime:NetCore21".
I have placed "additinalProperties" as 'false' for all the internal models where as it's type is, "object". This has resolved the my issue without adding additionalPropertie fields to my code. But, still it's adding for some of the models. For example,
Do, we have any option where we can able to place "additinalProperties" as false globally? Or do you guys has any solution from your side?
Regards, Abhishek