Treat object parameter as free-form object when the parameter does not specify additionalProperties=false explicitly in API spec
blackchoey opened this issue · 2 comments
Per https://swagger.io/docs/specification/data-models/data-types/, an object is free-form object by default if it doesn't specify additionalProperties=false
in API spec.
Currently, aaz-dev only treats object as free-form object when the object specifies additionalProperties=true
. Here's an example definition that falls into this situation, which will cause Failed to parse '--custom-properties' argument: "Model 'AAZObjectArg' has no field named 'xxx'"
error when user passes free-form object to the parameter:
"CustomProperties": {
"type": "object",
"description": "The custom metadata defined for API catalog entities."
},
The expected behavior is aaz-dev can treat above parameter as free-form object and allow users pass values with arbitrary properties.
You can use https://github.com/Azure/azure-rest-api-specs/blob/main/specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/apicenter.json to test the behavior.
In the meanwhile, is there any way to skip the validation for the --custom-properties
parameter I provided in the example? So we don't need to wait for spec update or aaz-dev update to fix the error.
imo, temporarily modify the local swagger could be a workaround here